#include "ColladaFileWriter.h"

// -------------------------------------------------------------------------------------------------------------------------------------
//		Strings
// -------------------------------------------------------------------------------------------------------------------------------------

// The list of COLLADA strings. In order to make reading easier, they should be grouped together by prefix (ATTR_*, ELEM_*, ENUM_* and VERSION_*)
// and sorted alphabetically.
// You can use the following IDE macro code to sort your selection on a per-line basis:
// Sub SortSelectedText()
//     Dim Selection As TextSelection = DTE.ActiveDocument.Selection
//     Dim Lines() As String = Selection.Text.Replace(Environment.NewLine, Chr(13)).Split(Chr(13))
//     Array.Sort(Lines)
//     DTE.UndoContext.Open("Sort Lines")
//     Selection.Delete()
//     Selection.Insert(String.Join(Environment.NewLine, Lines))
//     DTE.UndoContext.Close()
// End Sub
// (credits: http://stackoverflow.com/questions/5675636/visual-studio-2010-sort-functions-in-the-editor-alphabetically)
namespace ColladaStrings
{
	const string ATTR_ARRAY_INDEX = "array_index";
	const string ATTR_AUTO_GENERATE = "auto_generate";
	const string ATTR_AXIS = "axis";
	const string ATTR_BASE = "base";
	const string ATTR_BODY = "body";
	const string ATTR_CAMERA_NODE = "camera_node";
	const string ATTR_CHANNELS = "channels";
	const string ATTR_CLOSED = "closed";
	const string ATTR_CLOSED_U = "closed_u";
	const string ATTR_CLOSED_V = "closed_v";
	const string ATTR_CONSTRAINT = "constraint";
	const string ATTR_CONVEX_HULL_OF = "convex_hull_of";
	const string ATTR_COUNT = "count";
	const string ATTR_DEGREE = "degree";
	const string ATTR_DEGREE_U = "degree_u";
	const string ATTR_DEGREE_V = "degree_v";
	const string ATTR_DEPTH = "depth";
	const string ATTR_DIGITS = "digits";
	const string ATTR_ENABLE = "enable";
	const string ATTR_END = "end";
	const string ATTR_ENTRY = "entry";
	const string ATTR_FACE = "face";
	const string ATTR_FORMAT = "format";
	const string ATTR_HEIGHT = "height";
	const string ATTR_ID = "id";
	const string ATTR_INDEX = "index";
	const string ATTR_INPUT_SEMANTIC = "input_semantic";
	const string ATTR_INPUT_SET = "input_set";
	const string ATTR_JOINT = "joint";
	const string ATTR_LANGUAGE = "language";
	const string ATTR_LAYER = "layer";
	const string ATTR_LENGTH = "length";
	const string ATTR_LEVELS = "levels";
	const string ATTR_LINK = "link";
	const string ATTR_MAGNITUDE = "magnitude";
	const string ATTR_MATERIAL = "material";
	const string ATTR_MAXINCLUSIVE = "maxInclusive";
	const string ATTR_METER = "meter";
	const string ATTR_METHOD = "method";
	const string ATTR_MININCLUSIVE = "minInclusive";
	const string ATTR_MIP = "mip";
	const string ATTR_MIP_INDEX = "mip_index";
	const string ATTR_MIPS_GENERATE = "mips_generate";
	const string ATTR_MODE = "mode";
	const string ATTR_NAME = "name";
	const string ATTR_NODE = "node";
	const string ATTR_OFFSET = "offset";
	const string ATTR_OPAQUE = "opaque";
	const string ATTR_OPERAND = "operand";
	const string ATTR_OPERATOR = "operator";
	const string ATTR_OPTIONS = "options";
	const string ATTR_PARAM = "param";
	const string ATTR_PARENT = "parent";
	const string ATTR_PASS = "pass";
	const string ATTR_PLATFORM = "platform";
	const string ATTR_POST_BEHAVIOR = "post_behavior";
	const string ATTR_PRE_BEHAVIOR = "pre_behavior";
	const string ATTR_PRECISION = "precision";
	const string ATTR_PROFILE = "profile";
	const string ATTR_PROXY = "proxy";
	const string ATTR_RANGE = "range";
	const string ATTR_REF = "ref";
	const string ATTR_RESIZABLE = "resizable";
	const string ATTR_RIGID_BODY = "rigid_body";
	const string ATTR_SAMPLER = "sampler";
	const string ATTR_SCALE = "scale";
	const string ATTR_SEMANTIC = "semantic";
	const string ATTR_SET = "set";
	const string ATTR_SHARE = "share";
	const string ATTR_SID = "sid";
	const string ATTR_SLICE = "slice";
	const string ATTR_SOURCE = "source";
	const string ATTR_SPACE = "space";
	const string ATTR_STAGE = "stage";
	const string ATTR_START = "start";
	const string ATTR_STRIDE = "stride";
	const string ATTR_SYMBOL = "symbol";
	const string ATTR_TARGET = "target";
	const string ATTR_TEXCOORD = "texcoord";
	const string ATTR_TEXTURE = "texture";
	const string ATTR_TYPE = "type";
	const string ATTR_TYPENAME = "typename";
	const string ATTR_URL = "url";
	const string ATTR_VALUE = "value";
	const string ATTR_VERSION = "version";
	const string ATTR_WIDTH = "width";
	const string ATTR_XMLNS = "xmlns";

	const string ELEM_ACCESSOR = "accessor";
	const string ELEM_ALPHA = "alpha";
	const string ELEM_ALTITUDE = "altitude";
	const string ELEM_AMBIENT = "ambient";
	const string ELEM_ANGLE = "angle";
	const string ELEM_ANGULAR = "angular";
	const string ELEM_ANGULAR_VELOCITY = "angular_velocity";
	const string ELEM_ANIMATION = "animation";
	const string ELEM_ANIMATION_CLIP = "animation_clip";
	const string ELEM_ANNOTATE = "annotate";
	const string ELEM_ARGUMENT = "argument";
	const string ELEM_ARRAY = "array";
	const string ELEM_ARTICULATED_SYSTEM = "articulated_system";
	const string ELEM_ASPECT_RATIO = "aspect_ratio";
	const string ELEM_ASSET = "asset";
	const string ELEM_ATTACHMENT = "attachment";
	const string ELEM_ATTACHMENT_END = "attachment_end";
	const string ELEM_ATTACHMENT_FULL = "attachment_full";
	const string ELEM_ATTACHMENT_START = "attachment_start";
	const string ELEM_AUTHOR = "author";
	const string ELEM_AUTHOR_EMAIL = "author_email";
	const string ELEM_AUTHOR_WEBSITE = "author_website";
	const string ELEM_AUTHORING_TOOL = "authoring_tool";
	const string ELEM_AXIS = "axis";
	const string ELEM_AXIS_INFO = "axis_info";
	const string ELEM_BINARY = "binary";
	const string ELEM_BIND = "bind";
	const string ELEM_BIND_ATTRIBUTE = "bind_attribute";
	const string ELEM_BIND_JOINT_AXIS = "bind_joint_axis";
	const string ELEM_BIND_KINEMATICS_MODEL = "bind_kinematics_model";
	const string ELEM_BIND_MATERIAL = "bind_material";
	const string ELEM_BIND_SHAPE_MATRIX = "bind_shape_matrix";
	const string ELEM_BIND_UNIFORM = "bind_uniform";
	const string ELEM_BIND_VERTEX_INPUT = "bind_vertex_input";
	const string ELEM_BLINN = "blinn";
	const string ELEM_BOOL = "bool";
	const string ELEM_BOOL_ARRAY = "bool_array";
	const string ELEM_BOOL2 = "bool2";
	const string ELEM_BOOL3 = "bool3";
	const string ELEM_BOOL4 = "bool4";
	const string ELEM_BORDER_COLOR = "border_color";
	const string ELEM_BOX = "box";
	const string ELEM_BREP = "brep";
	const string ELEM_CAMERA = "camera";
	const string ELEM_CAPSULE = "capsule";
	const string ELEM_CHANNEL = "channel";
	const string ELEM_CIRCLE = "circle";
	const string ELEM_CODE = "code";
	const string ELEM_COLLADA = "COLLADA";
	const string ELEM_COLOR = "color";
	const string ELEM_COLOR_CLEAR = "color_clear";
	const string ELEM_COLOR_TARGET = "color_target";
	const string ELEM_COMMENTS = "comments";
	const string ELEM_COMPILER = "compiler";
	const string ELEM_CONE = "cone";
	const string ELEM_CONNECT_PARAM = "connect_param";
	const string ELEM_CONSTANT = "constant";
	const string ELEM_CONSTANT_ATTENUATION = "constant_attenuation";
	const string ELEM_CONTRIBUTOR = "contributor";
	const string ELEM_CONTROL_VERTICES = "control_vertices";
	const string ELEM_CONTROLLER = "controller";
	const string ELEM_CONVEX_MESH = "convex_mesh";
	const string ELEM_COPYRIGHT = "copyright";
	const string ELEM_COVERAGE = "coverage";
	const string ELEM_CREATE_2D = "create_2d";
	const string ELEM_CREATE_3D = "create_3d";
	const string ELEM_CREATE_CUBE = "create_cube";
	const string ELEM_CREATED = "created";
	const string ELEM_CURVE = "curve";
	const string ELEM_CURVES = "curves";
	const string ELEM_CYLINDER = "cylinder";
	const string ELEM_DAMPING = "damping";
	const string ELEM_DENSITY = "density";
	const string ELEM_DEPTH_CLEAR = "depth_clear";
	const string ELEM_DEPTH_TARGET = "depth_target";
	const string ELEM_DIFFUSE = "diffuse";
	const string ELEM_DIRECTION = "direction";
	const string ELEM_DIRECTIONAL = "directional";
	const string ELEM_DRAW = "draw";
	const string ELEM_DYNAMIC = "dynamic";
	const string ELEM_DYNAMIC_FRICTION = "dynamic_friction";
	const string ELEM_EDGES = "edges";
	const string ELEM_EFFECT = "effect";
	const string ELEM_EFFECTOR_INFO = "effector_info";
	const string ELEM_ELLIPSE = "ellipse";
	const string ELEM_EMISSION = "emission";
	const string ELEM_ENABLED = "enabled";
	const string ELEM_EQUATION = "equation";
	const string ELEM_EVALUATE = "evaluate";
	const string ELEM_EVALUATE_SCENE = "evaluate_scene";
	const string ELEM_EXACT = "exact";
	const string ELEM_EXTRA = "extra";
	const string ELEM_FACES = "faces";
	const string ELEM_FALLOFF_ANGLE = "falloff_angle";
	const string ELEM_FALLOFF_EXPONENT = "falloff_exponent";
	const string ELEM_FLOAT = "float";
	const string ELEM_FLOAT_ARRAY = "float_array";
	const string ELEM_FLOAT2 = "float2";
	const string ELEM_FLOAT2X2 = "float2x2";
	const string ELEM_FLOAT3 = "float3";
	const string ELEM_FLOAT3X3 = "float3x3";
	const string ELEM_FLOAT4 = "float4";
	const string ELEM_FLOAT4X4 = "float4x4";
	const string ELEM_FOCAL = "focal";
	const string ELEM_FORCE_FIELD = "force_field";
	const string ELEM_FORMAT = "format";
	const string ELEM_FORMULA = "formula";
	const string ELEM_FRAME_OBJECT = "frame_object";
	const string ELEM_FRAME_ORIGIN = "frame_origin";
	const string ELEM_FRAME_TCP = "frame_tcp";
	const string ELEM_FRAME_TIP = "frame_tip";
	const string ELEM_GEOGRAPHIC_LOCATION = "geographic_location";
	const string ELEM_GEOMETRY = "geometry";
	const string ELEM_GRAVITY = "gravity";
	const string ELEM_HALF_EXTENTS = "half_extents";
	const string ELEM_HEIGHT = "height";
	const string ELEM_HEX = "hex";
	const string ELEM_HINT = "hint";
	const string ELEM_HOLLOW = "hollow";
	const string ELEM_HYPERBOLA = "hyperbola";
	const string ELEM_IDREF = "IDREF";
	const string ELEM_IDREF_ARRAY = "IDREF_array";
	const string ELEM_IMAGE = "image";
	const string ELEM_IMAGER = "imager";
	const string ELEM_IMPORT = "import";
	const string ELEM_INCLUDE = "include";
	const string ELEM_INDEX_OF_REFRACTION = "index_of_refraction";
	const string ELEM_INERTIA = "inertia";
	const string ELEM_INIT_FROM = "init_from";
	const string ELEM_INLINE = "inline";
	const string ELEM_INPUT = "input";
	const string ELEM_INSTANCE_ANIMATION = "instance_animation";
	const string ELEM_INSTANCE_ARTICULATED_SYSTEM = "instance_articulated_system";
	const string ELEM_INSTANCE_CAMERA = "instance_camera";
	const string ELEM_INSTANCE_CONTROLLER = "instance_controller";
	const string ELEM_INSTANCE_EFFECT = "instance_effect";
	const string ELEM_INSTANCE_FORCE_FIELD = "instance_force_field";
	const string ELEM_INSTANCE_FORMULA = "instance_formula";
	const string ELEM_INSTANCE_GEOMETRY = "instance_geometry";
	const string ELEM_INSTANCE_IMAGE = "instance_image";
	const string ELEM_INSTANCE_JOINT = "instance_joint";
	const string ELEM_INSTANCE_KINEMATICS_MODEL = "instance_kinematics_model";
	const string ELEM_INSTANCE_KINEMATICS_SCENE = "instance_kinematics_scene";
	const string ELEM_INSTANCE_LIGHT = "instance_light";
	const string ELEM_INSTANCE_MATERIAL = "instance_material";
	const string ELEM_INSTANCE_NODE = "instance_node";
	const string ELEM_INSTANCE_PHYSICS_MATERIAL = "instance_physics_material";
	const string ELEM_INSTANCE_PHYSICS_MODEL = "instance_physics_model";
	const string ELEM_INSTANCE_PHYSICS_SCENE = "instance_physics_scene";
	const string ELEM_INSTANCE_RIGID_BODY = "instance_rigid_body";
	const string ELEM_INSTANCE_RIGID_CONSTRAINT = "instance_rigid_constraint";
	const string ELEM_INSTANCE_VISUAL_SCENE = "instance_visual_scene";
	const string ELEM_INT = "int";
	const string ELEM_INT_ARRAY = "int_array";
	const string ELEM_INT2 = "int2";
	const string ELEM_INT3 = "int3";
	const string ELEM_INT4 = "int4";
	const string ELEM_INTERPENETRATE = "interpenetrate";
	const string ELEM_JOINT = "joint";
	const string ELEM_JOINTS = "joints";
	const string ELEM_KEYWORDS = "keywords";
	const string ELEM_KINEMATICS = "kinematics";
	const string ELEM_KINEMATICS_MODEL = "kinematics_model";
	const string ELEM_KINEMATICS_SCENE = "kinematics_scene";
	const string ELEM_LAMBERT = "lambert";
	const string ELEM_LATITUDE = "latitude";
	const string ELEM_LAYER = "layer";
	const string ELEM_LIBRARY_ANIMATION_CLIPS = "library_animation_clips";
	const string ELEM_LIBRARY_ANIMATIONS = "library_animations";
	const string ELEM_LIBRARY_ARTICUALED_SYSTEMS = "library_articualed_systems";
	const string ELEM_LIBRARY_CAMERAS = "library_cameras";
	const string ELEM_LIBRARY_CONTROLLERS = "library_controllers";
	const string ELEM_LIBRARY_EFFECTS = "library_effects";
	const string ELEM_LIBRARY_FORCE_FIELDS = "library_force_fields";
	const string ELEM_LIBRARY_FORMULAS = "library_formulas";
	const string ELEM_LIBRARY_GEOMETRIES = "library_geometries";
	const string ELEM_LIBRARY_IMAGES = "library_images";
	const string ELEM_LIBRARY_JOINTS = "library_joints";
	const string ELEM_LIBRARY_KINEMATICS_MODELS = "library_kinematics_models";
	const string ELEM_LIBRARY_KINEMATICS_SCENES = "library_kinematics_scenes";
	const string ELEM_LIBRARY_LIGHTS = "library_lights";
	const string ELEM_LIBRARY_MATERIALS = "library_materials";
	const string ELEM_LIBRARY_NODES = "library_nodes";
	const string ELEM_LIBRARY_PHYSICS_MATERIALS = "library_physics_materials";
	const string ELEM_LIBRARY_PHYSICS_MODELS = "library_physics_models";
	const string ELEM_LIBRARY_PHYSICS_SCENES = "library_physics_scenes";
	const string ELEM_LIBRARY_VISUAL_SCENES = "library_visual_scenes";
	const string ELEM_LIGHT = "light";
	const string ELEM_LIMITS = "limits";
	const string ELEM_LINE = "line";
	const string ELEM_LINEAR = "linear";
	const string ELEM_LINEAR_ATTENUATION = "linear_attenuation";
	const string ELEM_LINES = "lines";
	const string ELEM_LINESTRIPS = "linestrips";
	const string ELEM_LINK = "link";
	const string ELEM_LINKER = "linker";
	const string ELEM_LONGITUDE = "longitude";
	const string ELEM_LOOKAT = "lookat";
	const string ELEM_MAGFILTER = "magfilter";
	const string ELEM_MASS = "mass";
	const string ELEM_MASS_FRAME = "mass_frame";
	const string ELEM_MATERIAL = "material";
	const string ELEM_MATRIX = "matrix";
	const string ELEM_MAX = "max";
	const string ELEM_MAX_ANISOTROPY = "max_anisotropy";
	const string ELEM_MESH = "mesh";
	const string ELEM_MIN = "min";
	const string ELEM_MINFILTER = "minfilter";
	const string ELEM_MIP_BIAS = "mip_bias";
	const string ELEM_MIP_MAX_LEVEL = "mip_max_level";
	const string ELEM_MIP_MIN_LEVEL = "mip_min_level";
	const string ELEM_MIPFILTER = "mipfilter";
	const string ELEM_MIPS = "mips";
	const string ELEM_MODIFIED = "modified";
	const string ELEM_MODIFIER = "modifier";
	const string ELEM_MORPH = "morph";
	const string ELEM_MOTION = "motion";
	const string ELEM_NAME_ARRAY = "Name_array";
	const string ELEM_NEWPARAM = "newparam";
	const string ELEM_NODE = "node";
	const string ELEM_NURBS = "nurbs";
	const string ELEM_NURBS_SURFACE = "nurbs_surface";
	const string ELEM_OPTICS = "optics";
	const string ELEM_ORIENT = "orient";
	const string ELEM_ORIGIN = "origin";
	const string ELEM_ORTHOGRAPHIC = "orthographic";
	const string ELEM_P = "p";
	const string ELEM_PARABOLA = "parabola";
	const string ELEM_PARAM = "param";
	const string ELEM_PASS = "pass";
	const string ELEM_PCURVES = "pcurves";
	const string ELEM_PERSPECTIVE = "perspective";
	const string ELEM_PH = "ph";
	const string ELEM_PHONG = "phong";
	const string ELEM_PHYSICS_MATERIAL = "physics_material";
	const string ELEM_PHYSICS_MODEL = "physics_model";
	const string ELEM_PHYSICS_SCENE = "physics_scene";
	const string ELEM_PLANE = "plane";
	const string ELEM_POINT = "point";
	const string ELEM_POLYGONS = "polygons";
	const string ELEM_POLYLIST = "polylist";
	const string ELEM_PRISMATIC = "prismatic";
	const string ELEM_PROFILE_BRIDGE = "profile_BRIDGE";
	const string ELEM_PROFILE_CG = "profile_CG";
	const string ELEM_PROFILE_COMMON = "profile_COMMON";
	const string ELEM_PROFILE_GLES = "profile_GLES";
	const string ELEM_PROFILE_GLES2 = "profile_GLES2";
	const string ELEM_PROFILE_GLSL = "profile_GLSL";
	const string ELEM_PROGRAM = "program";
	const string ELEM_QUADRATIC_ATTENUATION = "quadratic_attenuation";
	const string ELEM_RADIUS = "radius";
	const string ELEM_REF = "ref";
	const string ELEM_REF_ATTACHMENT = "ref_attachment";
	const string ELEM_REFLECTIVE = "reflective";
	const string ELEM_REFLECTIVITY = "reflectivity";
	const string ELEM_RENDER = "render";
	const string ELEM_RENDERABLE = "renderable";
	const string ELEM_RESTITUTION = "restitution";
	const string ELEM_REVISION = "revision";
	const string ELEM_REVOLUTE = "revolute";
	const string ELEM_RGB = "RGB";
	const string ELEM_RIGID_BODY = "rigid_body";
	const string ELEM_RIGID_CONSTRAINT = "rigid_constraint";
	const string ELEM_ROTATE = "rotate";
	const string ELEM_SAMPLER = "sampler";
	const string ELEM_SAMPLER_IMAGE = "sampler_image";
	const string ELEM_SAMPLER_STATES = "sampler_states";
	const string ELEM_SAMPLER1D = "sampler1D";
	const string ELEM_SAMPLER2D = "sampler2D";
	const string ELEM_SAMPLER3D = "sampler3D";
	const string ELEM_SAMPLERCUBE = "samplerCUBE";
	const string ELEM_SAMPLERDEPTH = "samplerDEPTH";
	const string ELEM_SAMPLERRECT = "samplerRECT";
	const string ELEM_SCALE = "scale";
	const string ELEM_SCENE = "scene";
	const string ELEM_SEMANTIC = "semantic";
	const string ELEM_SETPARAM = "setparam";
	const string ELEM_SHADER = "shader";
	const string ELEM_SHAPE = "shape";
	const string ELEM_SHELLS = "shells";
	const string ELEM_SHININESS = "shininess";
	const string ELEM_SIDREF = "SIDREF";
	const string ELEM_SIDREF_ARRAY = "SIDREF_array";
	const string ELEM_SIZE = "size";
	const string ELEM_SIZE_EXACT = "size_exact";
	const string ELEM_SIZE_RATIO = "size_ratio";
	const string ELEM_SKELETON = "skeleton";
	const string ELEM_SKEW = "skew";
	const string ELEM_SKIN = "skin";
	const string ELEM_SOLIDS = "solids";
	const string ELEM_SOURCE = "source";
	const string ELEM_SOURCE_DATA = "source_data";
	const string ELEM_SOURCES = "sources";
	const string ELEM_SPECULAR = "specular";
	const string ELEM_SPHERE = "sphere";
	const string ELEM_SPLINE = "spline";
	const string ELEM_SPOT = "spot";
	const string ELEM_SPRING = "spring";
	const string ELEM_STATES = "states";
	const string ELEM_STATIC_FRICTION = "static_friction";
	const string ELEM_STENCIL_CLEAR = "stencil_clear";
	const string ELEM_STENCIL_TARGET = "stencil_target";
	const string ELEM_STIFFNESS = "stiffness";
	const string ELEM_STRING = "string";
	const string ELEM_SUBJECT = "subject";
	const string ELEM_SURFACE = "surface";
	const string ELEM_SURFACE_CURVES = "surface_curves";
	const string ELEM_SURFACES = "surfaces";
	const string ELEM_SWEPT_SURFACE = "swept_surface";
	const string ELEM_SWING_CONT_AND_TWIST = "swing_cone_and_twist";
	const string ELEM_TARGET_VALUE = "target_value";
	const string ELEM_TARGETS = "targets";
	const string ELEM_TECHNIQUE = "technique";
	const string ELEM_TECHNIQUE_COMMON = "technique_common";
	const string ELEM_TECHNIQUE_HINT = "technique_hint";
	const string ELEM_TECHNIQUE_OVERRIDE = "technique_override";
	const string ELEM_TEXCOMBINER = "texcombiner";
	const string ELEM_TEXCOORD = "texcoord";
	const string ELEM_TEXENV = "texenv";
	const string ELEM_TEXTURE = "texture";
	const string ELEM_TEXTURE_PIPELINE = "texture_pipeline";
	const string ELEM_TIME_STEP = "time_step";
	const string ELEM_TITLE = "title";
	const string ELEM_TORUS = "torus";
	const string ELEM_TRANSLATE = "translate";
	const string ELEM_TRANSPARENCY = "transparency";
	const string ELEM_TRANSPARENT = "transparent";
	const string ELEM_TRIANGLES = "triangles";
	const string ELEM_TRIFANS = "trifans";
	const string ELEM_TRISTRIPS = "tristrips";
	const string ELEM_UNIT = "unit";
	const string ELEM_UNNORMALIZED = "unnormalized";
	const string ELEM_UP_AXIS = "up_axis";
	const string ELEM_USERTYPE = "usertype";
	const string ELEM_VCOUNT = "vcount";
	const string ELEM_VELOCITY = "velocity";
	const string ELEM_VERTEX_WEIGHTS = "vertex_weights";
	const string ELEM_VERTICES = "vertices";
	const string ELEM_VISUAL_SCENE = "visual_scene";
	const string ELEM_WIRES = "wires";
	const string ELEM_WRAP_P = "wrap_p";
	const string ELEM_WRAP_S = "wrap_s";
	const string ELEM_WRAP_T = "wrap_t";
	const string ELEM_XFOV = "xfov";
	const string ELEM_XMAG = "xmag";
	const string ELEM_YFOV = "yfov";
	const string ELEM_YMAG = "ymag";
	const string ELEM_ZFAR = "zfar";
	const string ELEM_ZNEAR = "znear";

	const string ENUM_A_ONE = "A_ONE";
	const string ENUM_A_ZERO = "A_ZERO";
	const string ENUM_ABSOLUTE = "absolute";
	const string ENUM_ADD = "ADD";
	const string ENUM_ADD_SIGNED = "ADD_SIGNED";
	const string ENUM_ANISOTROPIC = "ANISOTROPIC";
	const string ENUM_BLEND = "BLEND";
	const string ENUM_BORDER = "BORDER";
	const string ENUM_CLAMP = "CLAMP";
	const string ENUM_CONSTANT = "CONSTANT";
	const string ENUM_CYCLE = "CYCLE";
	const string ENUM_CYCLE_RELATIVE = "CYCLE_RELATIVE";
	const string ENUM_D = "D";
	const string ENUM_DECAL = "DECAL";
	const string ENUM_DEFAULT = "DEFAULT";
	const string ENUM_DOT3_RGB = "DOT3_RGB";
	const string ENUM_DOT3_RGBA = "DOT3_RGBA";
	const string ENUM_FLOAT = "FLOAT";
	const string ENUM_FRAGMENT = "FRAGMENT";
	const string ENUM_FULL_SCREEN_QUAD = "FULL_SCREEN_QUAD";
	const string ENUM_FULL_SCREEN_QUAD_PLUS_HALF_PIXEL = "FULL_SCREEN_QUAD_PLUS_HALF_PIXEL";
	const string ENUM_GEOMETRY = "GEOMETRY";
	const string ENUM_GRADIENT = "GRADIENT";
	const string ENUM_HIGH = "HIGH";
	const string ENUM_INTERPOLATE = "INTERPOLATE";
	const string ENUM_JOINT = "JOINT";
	const string ENUM_L = "L";
	const string ENUM_LA = "LA";
	const string ENUM_LINEAR = "LINEAR";
	const string ENUM_LOW = "LOW";
	const string ENUM_MAX = "MAX";
	const string ENUM_MID = "MID";
	const string ENUM_MIRROR = "MIRROR";
	const string ENUM_MIRROR_ONCE = "MIRROR_ONCE";
	const string ENUM_MODULATE = "MODULATE";
	const string ENUM_NEAREST = "NEAREST";
	const string ENUM_NEGATIVE_X = "NEGATIVE_X";
	const string ENUM_NEGATIVE_Y = "NEGATIVE_Y";
	const string ENUM_NEGATIVE_Z = "NEGATIVE_Z";
	const string ENUM_NODE = "NODE";
	const string ENUM_NONE = "NONE";
	const string ENUM_NORMALIZED = "NORMALIZED";
	const string ENUM_ONE_MINUS_SRC_ALPHA = "ONE_MINUS_SRC_ALPHA";
	const string ENUM_ONE_MINUS_SRC_COLOR = "ONE_MINUS_SRC_COLOR";
	const string ENUM_OSCILLATE = "OSCILLATE";
	const string ENUM_POSITIVE_X = "POSITIVE_X";
	const string ENUM_POSITIVE_Y = "POSITIVE_Y";
	const string ENUM_POSITIVE_Z = "POSITIVE_Z";
	const string ENUM_PREVIOUS = "PREVIOUS";
	const string ENUM_PRIMARY = "PRIMARY";
	const string ENUM_RELATIVE = "RELATIVE";
	const string ENUM_RELATIVETOGROUND = "relativeToGround";
	const string ENUM_REPLACE = "REPLACE";
	const string ENUM_RGB = "RGB";
	const string ENUM_RGB_ONE = "RGB_ONE";
	const string ENUM_RGB_ZERO = "RGB_ZERO";
	const string ENUM_RGBA = "RGBA";
	const string ENUM_RGBE = "RGBE";
	const string ENUM_SCENE_GEOMETRY = "SCENE_GEOMETRY";
	const string ENUM_SCENE_IMAGE = "SCENE_IMAGE";
	const string ENUM_SINT = "SINT";
	const string ENUM_SNORM = "SNORM";
	const string ENUM_SRC_ALPHA = "SRC_ALPHA";
	const string ENUM_SRC_COLOR = "SRC_COLOR";
	const string ENUM_SUBTRACT = "SUBTRACT";
	const string ENUM_TESSELATION = "TESSELATION";
	const string ENUM_TEXTURE = "TEXTURE";
	const string ENUM_UINT = "UINT";
	const string ENUM_UNDEFINED = "UNDEFINED";
	const string ENUM_UNORM = "UNORM";
	const string ENUM_VERTEX = "VERTEX";
	const string ENUM_WRAP = "WRAP";
	const string ENUM_X_UP = "X_UP";
	const string ENUM_Y_UP = "Y_UP";
	const string ENUM_Z_UP = "Z_UP";

	const string VERSION_1_5_0 = "1.5.0";
};

// -------------------------------------------------------------------------------------------------------------------------------------
//		Base Classes & Macros
// -------------------------------------------------------------------------------------------------------------------------------------

ColladaFileWriter& ColladaElementWriter::GetFileWriter() const
{
	return m_Writer;
}

ColladaVersion::Type ColladaElementWriter::GetVersion() const
{
	return m_Writer.m_Version;
}

XmlFileWriter& ColladaElementWriter::GetXmlWriter() const
{
	return m_Writer.m_XmlWriter;
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<accessor>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_AddParam(ColladaAccessorWriter)

void ColladaAccessorWriter::SetOffset(unsigned int value)
{
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_OFFSET, value);
}

void ColladaAccessorWriter::SetStride(unsigned int value)
{
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_STRIDE, value);
}

ColladaAccessorWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaAccessorWriter, const string& source, unsigned int count)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_ACCESSOR);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_SOURCE, source);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_COUNT, count);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<ambient> (Core)
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_AddColor(ColladaAmbientCoreWriter)

ColladaAmbientCoreWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaAmbientCoreWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_AMBIENT);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<animation>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetID(ColladaAnimationWriter)
COLLADA_DEFINE_SetName(ColladaAnimationWriter)
COLLADA_DEFINE_OpenAsset(ColladaAnimationWriter)
COLLADA_DEFINE_OpenExtra(ColladaAnimationWriter)

void ColladaAnimationWriter::AddChannel(const string& source, const string& target)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_CHANNEL);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_SOURCE, source);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_TARGET, target);
	GetXmlWriter().CloseElement();
}

ColladaAnimationWriter ColladaAnimationWriter::OpenAnimation()
{
	return ColladaAnimationWriter(GetFileWriter());
}

ColladaSourceCoreWriter ColladaAnimationWriter::OpenSource(const string& id)
{
	return ColladaSourceCoreWriter(GetFileWriter(), id);
}

ColladaSamplerWriter ColladaAnimationWriter::OpenSampler()
{
	return ColladaSamplerWriter(GetFileWriter());
}

ColladaAnimationWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaAnimationWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_ANIMATION);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<animation_clip>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetID(ColladaAnimationClipWriter)
COLLADA_DEFINE_SetName(ColladaAnimationClipWriter)
COLLADA_DEFINE_OpenAsset(ColladaAnimationClipWriter)
COLLADA_DEFINE_OpenExtra(ColladaAnimationClipWriter)

void ColladaAnimationClipWriter::SetStart(double value)
{
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_START, value);
}

void ColladaAnimationClipWriter::SetEnd(double value)
{
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_END, value);
}

ColladaInstanceAnimationWriter ColladaAnimationClipWriter::OpenInstanceAnimation(const string& url)
{
	return ColladaInstanceAnimationWriter(GetFileWriter(), url);
}

ColladaInstanceFormulaWriter ColladaAnimationClipWriter::OpenInstanceFormula(const string& url)
{
	return ColladaInstanceFormulaWriter(GetFileWriter(), url);
}

ColladaAnimationClipWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaAnimationClipWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_ANIMATION_CLIP);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<asset>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_OpenExtra(ColladaAssetWriter)

void ColladaAssetWriter::AddCoverage(double longitude, double latitude, double altitude, ColladaAltitudeMode::Type altitudeMode)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_COVERAGE);
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_GEOGRAPHIC_LOCATION);
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_LONGITUDE);
	GetXmlWriter().AddContent(longitude);
	GetXmlWriter().CloseElement();
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_LATITUDE);
	GetXmlWriter().AddContent(latitude);
	GetXmlWriter().CloseElement();
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_ALTITUDE);
	switch (altitudeMode)
	{
		case ColladaAltitudeMode::Absolute:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_MODE, ColladaStrings::ENUM_ABSOLUTE); break;
		case ColladaAltitudeMode::RelativeToGround:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_MODE, ColladaStrings::ENUM_RELATIVETOGROUND); break;
	}
	GetXmlWriter().AddContent(altitude);
	GetXmlWriter().CloseElement();
	GetXmlWriter().CloseElement();
	GetXmlWriter().CloseElement();
}

void ColladaAssetWriter::AddCreated(time_t value)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_CREATED);
	GetXmlWriter().AddContent(value);
	GetXmlWriter().CloseElement();
}

void ColladaAssetWriter::AddKeywords(const string& value)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_KEYWORDS);
	GetXmlWriter().AddContent(value);
	GetXmlWriter().CloseElement();
}

void ColladaAssetWriter::AddModified(time_t value)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_MODIFIED);
	GetXmlWriter().AddContent(value);
	GetXmlWriter().CloseElement();
}

void ColladaAssetWriter::AddRevision(const string& value)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_REVISION);
	GetXmlWriter().AddContent(value);
	GetXmlWriter().CloseElement();
}

void ColladaAssetWriter::AddSubject(const string& value)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_SUBJECT);
	GetXmlWriter().AddContent(value);
	GetXmlWriter().CloseElement();
}

void ColladaAssetWriter::AddTitle(const string& value)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_TITLE);
	GetXmlWriter().AddContent(value);
	GetXmlWriter().CloseElement();
}

void ColladaAssetWriter::AddUnit(const string& name, double meter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_UNIT);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_NAME, name);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_METER, meter);
	GetXmlWriter().CloseElement();
}

void ColladaAssetWriter::AddUpAxis(ColladaAxis::Type value)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_UP_AXIS);
	switch (value)
	{
		case ColladaAxis::X:
			GetXmlWriter().AddContent(ColladaStrings::ENUM_X_UP);
			break;
		case ColladaAxis::Y:
			GetXmlWriter().AddContent(ColladaStrings::ENUM_Y_UP);
			break;
		case ColladaAxis::Z:
			GetXmlWriter().AddContent(ColladaStrings::ENUM_Z_UP);
			break;
	}
	GetXmlWriter().CloseElement();
}

ColladaContributorWriter ColladaAssetWriter::OpenContributor()
{
	return ColladaContributorWriter(GetFileWriter());
}

ColladaAssetWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaAssetWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_ASSET);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<bool_array>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetID(ColladaBoolArrayWriter)
COLLADA_DEFINE_SetName(ColladaBoolArrayWriter)

void ColladaBoolArrayWriter::Append(bool value)
{
	GetXmlWriter().AddContent(value);
}

void ColladaBoolArrayWriter::Append(bool* values, int count)
{
	GetXmlWriter().AddContent(values, count);
}

ColladaBoolArrayWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaBoolArrayWriter, unsigned int count)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_BOOL_ARRAY);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_COUNT, count);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<camera>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetID(ColladaCameraWriter)
COLLADA_DEFINE_SetName(ColladaCameraWriter)
COLLADA_DEFINE_OpenAsset(ColladaCameraWriter)
COLLADA_DEFINE_OpenExtra(ColladaCameraWriter)

ColladaOpticsWriter ColladaCameraWriter::OpenOptics()
{
	return ColladaOpticsWriter(GetFileWriter());
}

ColladaImagerWriter ColladaCameraWriter::OpenImager()
{
	return ColladaImagerWriter(GetFileWriter());
}

ColladaCameraWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaCameraWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_CAMERA);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<contributor>
// -------------------------------------------------------------------------------------------------------------------------------------

void ColladaContributorWriter::AddAuthor(const string& value)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_AUTHOR);
	GetXmlWriter().AddContent(value);
	GetXmlWriter().CloseElement();
}

void ColladaContributorWriter::AddAuthorEmail(const string& value)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_AUTHOR_EMAIL);
	GetXmlWriter().AddContent(value);
	GetXmlWriter().CloseElement();
}

void ColladaContributorWriter::AddAuthorWebsite(const string& value)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_AUTHOR_WEBSITE);
	GetXmlWriter().AddContent(value);
	GetXmlWriter().CloseElement();
}

void ColladaContributorWriter::AddAuthoringTool(const string& value)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_AUTHORING_TOOL);
	GetXmlWriter().AddContent(value);
	GetXmlWriter().CloseElement();
}

void ColladaContributorWriter::AddComments(const string& value)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_COMMENTS);
	GetXmlWriter().AddContent(value);
	GetXmlWriter().CloseElement();
}

void ColladaContributorWriter::AddCopyright(const string& value)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_COPYRIGHT);
	GetXmlWriter().AddContent(value);
	GetXmlWriter().CloseElement();
}

void ColladaContributorWriter::AddSourceData(const string& value)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_SOURCE_DATA);
	GetXmlWriter().AddContent(value);
	GetXmlWriter().CloseElement();
}

ColladaContributorWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaContributorWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_CONTRIBUTOR);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<controller>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetID(ColladaControllerWriter)
COLLADA_DEFINE_SetName(ColladaControllerWriter)
COLLADA_DEFINE_OpenAsset(ColladaControllerWriter)
COLLADA_DEFINE_OpenExtra(ColladaControllerWriter)

ColladaSkinWriter ColladaControllerWriter::OpenSkin(const string& source)
{
	return ColladaSkinWriter(GetFileWriter(), source);
}

ColladaMorphWriter ColladaControllerWriter::OpenMorph(const string& source)
{
	return ColladaMorphWriter(GetFileWriter(), source);
}

ColladaControllerWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaControllerWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_CONTROLLER);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<control_vertices>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_AddInputUnshared(ColladaControlVerticesWriter)
COLLADA_DEFINE_OpenExtra(ColladaControlVerticesWriter)

ColladaControlVerticesWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaControlVerticesWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_CONTROL_VERTICES);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<directional>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_AddColor(ColladaDirectionalWriter)

ColladaDirectionalWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaDirectionalWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_DIRECTIONAL);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<evaluate_scene>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetID(ColladaEvaluateSceneWriter)
COLLADA_DEFINE_SetName(ColladaEvaluateSceneWriter)
COLLADA_DEFINE_SetSID(ColladaEvaluateSceneWriter)
COLLADA_DEFINE_OpenAsset(ColladaEvaluateSceneWriter)
COLLADA_DEFINE_OpenExtra(ColladaEvaluateSceneWriter)

void ColladaEvaluateSceneWriter::SetEnable(bool value)
{
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_ENABLE, value);
}

ColladaRenderWriter ColladaEvaluateSceneWriter::OpenRender()
{
	return ColladaRenderWriter(GetFileWriter());
}

ColladaEvaluateSceneWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaEvaluateSceneWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_EVALUATE_SCENE);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<extra>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetID(ColladaExtraWriter)
COLLADA_DEFINE_SetName(ColladaExtraWriter)
COLLADA_DEFINE_OpenAsset(ColladaExtraWriter)
COLLADA_DEFINE_OpenTechniqueCore(ColladaExtraWriter)

// Writes an <extra> element.
void ColladaExtraWriter::SetType(const string& value)
{
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_TYPE, value);
}

ColladaExtraWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaExtraWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_EXTRA);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<float_array>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetID(ColladaFloatArrayWriter)
COLLADA_DEFINE_SetName(ColladaFloatArrayWriter)

void ColladaFloatArrayWriter::SetDigits(unsigned char value)
{
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_DIGITS, value);
}

void ColladaFloatArrayWriter::SetMagnitude(short value)
{
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_MAGNITUDE, value);
}

void ColladaFloatArrayWriter::Append(double value)
{
	GetXmlWriter().AddContent(value);
}

void ColladaFloatArrayWriter::Append(float* values, int count)
{
	GetXmlWriter().AddContent(values, count);
}

void ColladaFloatArrayWriter::Append(double* values, int count)
{
	GetXmlWriter().AddContent(values, count);
}

ColladaFloatArrayWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaFloatArrayWriter, unsigned int count)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_FLOAT_ARRAY);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_COUNT, count);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<formula>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetID(ColladaFormulaWriter)
COLLADA_DEFINE_SetName(ColladaFormulaWriter)
COLLADA_DEFINE_SetSID(ColladaFormulaWriter)
COLLADA_DEFINE_OpenExtra(ColladaFormulaWriter)

ColladaFormulaWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaFormulaWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_FORMULA);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<geometry>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetID(ColladaGeometryWriter)
COLLADA_DEFINE_SetName(ColladaGeometryWriter)
COLLADA_DEFINE_OpenAsset(ColladaGeometryWriter)
COLLADA_DEFINE_OpenExtra(ColladaGeometryWriter)

ColladaConvexMeshWriter ColladaGeometryWriter::OpenConvexMesh()
{
	return ColladaConvexMeshWriter(GetFileWriter());
}

ColladaMeshWriter ColladaGeometryWriter::OpenMesh()
{
	return ColladaMeshWriter(GetFileWriter());
}

ColladaSplineWriter ColladaGeometryWriter::OpenSpline()
{
	return ColladaSplineWriter(GetFileWriter());
}

ColladaBRepWriter ColladaGeometryWriter::OpenBRep()
{
	return ColladaBRepWriter(GetFileWriter());
}

ColladaGeometryWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaGeometryWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_GEOMETRY);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<IDREF_array>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetID(ColladaIDREFArrayWriter)
COLLADA_DEFINE_SetName(ColladaIDREFArrayWriter)

void ColladaIDREFArrayWriter::Append(const string& value)
{
	GetXmlWriter().AddContent(value);
}

ColladaIDREFArrayWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaIDREFArrayWriter, unsigned int count)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_IDREF_ARRAY);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_COUNT, count);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<imager>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_OpenTechniqueCore(ColladaImagerWriter)
COLLADA_DEFINE_OpenExtra(ColladaImagerWriter)

ColladaImagerWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaImagerWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_IMAGER);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<instance_animation>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetID(ColladaInstanceAnimationWriter)
COLLADA_DEFINE_SetName(ColladaInstanceAnimationWriter)
COLLADA_DEFINE_OpenExtra(ColladaInstanceAnimationWriter)

ColladaInstanceAnimationWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaInstanceAnimationWriter, const string& url)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_INSTANCE_ANIMATION);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_URL, url);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<instance_camera>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetID(ColladaInstanceCameraWriter)
COLLADA_DEFINE_SetName(ColladaInstanceCameraWriter)
COLLADA_DEFINE_OpenExtra(ColladaInstanceCameraWriter)

ColladaInstanceCameraWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaInstanceCameraWriter, const string& url)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_INSTANCE_CAMERA);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_URL, url);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<instance_controller>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetID(ColladaInstanceControllerWriter)
COLLADA_DEFINE_SetName(ColladaInstanceControllerWriter)
COLLADA_DEFINE_OpenExtra(ColladaInstanceControllerWriter)

ColladaSkeletonWriter ColladaInstanceControllerWriter::OpenSkeleton()
{
	return ColladaSkeletonWriter(GetFileWriter());
}

ColladaBindMaterialWriter ColladaInstanceControllerWriter::OpenBindMaterial()
{
	return ColladaBindMaterialWriter(GetFileWriter());
}

ColladaInstanceControllerWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaInstanceControllerWriter, const string& url)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_INSTANCE_CONTROLLER);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_URL, url);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<instance_formula>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetID(ColladaInstanceFormulaWriter)
COLLADA_DEFINE_SetName(ColladaInstanceFormulaWriter)
COLLADA_DEFINE_AddSetParam(ColladaInstanceFormulaWriter)
COLLADA_DEFINE_OpenExtra(ColladaInstanceFormulaWriter)

ColladaInstanceFormulaWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaInstanceFormulaWriter, const string& url)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_INSTANCE_FORMULA);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_URL, url);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<instance_geometry>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetID(ColladaInstanceGeometryWriter)
COLLADA_DEFINE_SetName(ColladaInstanceGeometryWriter)
COLLADA_DEFINE_OpenExtra(ColladaInstanceGeometryWriter)

ColladaBindMaterialWriter ColladaInstanceGeometryWriter::OpenBindMaterial()
{
	return ColladaBindMaterialWriter(GetFileWriter());
}

ColladaInstanceGeometryWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaInstanceGeometryWriter, const string& url)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_INSTANCE_GEOMETRY);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_URL, url);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<instance_light>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetID(ColladaInstanceLightWriter)
COLLADA_DEFINE_SetName(ColladaInstanceLightWriter)
COLLADA_DEFINE_OpenExtra(ColladaInstanceLightWriter)

ColladaInstanceLightWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaInstanceLightWriter, const string& url)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_INSTANCE_LIGHT);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_URL, url);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<instance_node>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetSID(ColladaInstanceNodeWriter)
COLLADA_DEFINE_SetName(ColladaInstanceNodeWriter)
COLLADA_DEFINE_OpenExtra(ColladaInstanceNodeWriter)

void ColladaInstanceNodeWriter::SetProxy(const string& value)
{
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_PROXY, value);
}

ColladaInstanceNodeWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaInstanceNodeWriter, const string& url)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_INSTANCE_NODE);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_URL, url);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<instance_visual_scene>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetID(ColladaInstanceVisualSceneWriter)
COLLADA_DEFINE_SetName(ColladaInstanceVisualSceneWriter)
COLLADA_DEFINE_OpenExtra(ColladaInstanceVisualSceneWriter)

ColladaInstanceVisualSceneWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaInstanceVisualSceneWriter, const string& url)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_INSTANCE_VISUAL_SCENE);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_URL, url);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<int_array>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetID(ColladaIntArrayWriter)
COLLADA_DEFINE_SetName(ColladaIntArrayWriter)

void ColladaIntArrayWriter::SetMinInclusive(int value)
{
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_MININCLUSIVE, value);
}

void ColladaIntArrayWriter::SetMaxInclusive(int value)
{
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_MAXINCLUSIVE, value);
}

void ColladaIntArrayWriter::Append(int value)
{
	GetXmlWriter().AddContent(value);
}

void ColladaIntArrayWriter::Append(int* values, int count)
{
	GetXmlWriter().AddContent(values, count);
}

ColladaIntArrayWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaIntArrayWriter, unsigned int count)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_INT_ARRAY);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_COUNT, count);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<joints>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_AddInputUnshared(ColladaJointsWriter)
COLLADA_DEFINE_OpenExtra(ColladaJointsWriter)

ColladaJointsWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaJointsWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_JOINTS);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<library_animation_clips>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetID(ColladaLibraryAnimationClipsWriter)
COLLADA_DEFINE_SetName(ColladaLibraryAnimationClipsWriter)
COLLADA_DEFINE_OpenAsset(ColladaLibraryAnimationClipsWriter)
COLLADA_DEFINE_OpenExtra(ColladaLibraryAnimationClipsWriter)

ColladaAnimationClipWriter ColladaLibraryAnimationClipsWriter::OpenAnimationClip()
{
	return ColladaAnimationClipWriter(GetFileWriter());
}

ColladaLibraryAnimationClipsWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaLibraryAnimationClipsWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_LIBRARY_ANIMATION_CLIPS);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<library_animations>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetID(ColladaLibraryAnimationsWriter)
COLLADA_DEFINE_SetName(ColladaLibraryAnimationsWriter)
COLLADA_DEFINE_OpenAsset(ColladaLibraryAnimationsWriter)
COLLADA_DEFINE_OpenExtra(ColladaLibraryAnimationsWriter)

ColladaAnimationWriter ColladaLibraryAnimationsWriter::OpenAnimation()
{
	return ColladaAnimationWriter(GetFileWriter());
}

ColladaLibraryAnimationsWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaLibraryAnimationsWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_LIBRARY_ANIMATIONS);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<library_cameras>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetID(ColladaLibraryCamerasWriter)
COLLADA_DEFINE_SetName(ColladaLibraryCamerasWriter)
COLLADA_DEFINE_OpenAsset(ColladaLibraryCamerasWriter)
COLLADA_DEFINE_OpenExtra(ColladaLibraryCamerasWriter)

ColladaCameraWriter ColladaLibraryCamerasWriter::OpenCamera()
{
	return ColladaCameraWriter(GetFileWriter());
}

ColladaLibraryCamerasWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaLibraryCamerasWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_LIBRARY_CAMERAS);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<library_controllers>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetID(ColladaLibraryControllersWriter)
COLLADA_DEFINE_SetName(ColladaLibraryControllersWriter)
COLLADA_DEFINE_OpenAsset(ColladaLibraryControllersWriter)
COLLADA_DEFINE_OpenExtra(ColladaLibraryControllersWriter)

ColladaControllerWriter ColladaLibraryControllersWriter::OpenController()
{
	return ColladaControllerWriter(GetFileWriter());
}

ColladaLibraryControllersWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaLibraryControllersWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_LIBRARY_CONTROLLERS);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<library_formulas>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetID(ColladaLibraryFormulasWriter)
COLLADA_DEFINE_SetName(ColladaLibraryFormulasWriter)
COLLADA_DEFINE_OpenAsset(ColladaLibraryFormulasWriter)
COLLADA_DEFINE_OpenExtra(ColladaLibraryFormulasWriter)

ColladaFormulaWriter ColladaLibraryFormulasWriter::OpenFormula()
{
	return ColladaFormulaWriter(GetFileWriter());
}

ColladaLibraryFormulasWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaLibraryFormulasWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_LIBRARY_FORMULAS);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<library_geometries>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetID(ColladaLibraryGeometriesWriter)
COLLADA_DEFINE_SetName(ColladaLibraryGeometriesWriter)
COLLADA_DEFINE_OpenAsset(ColladaLibraryGeometriesWriter)
COLLADA_DEFINE_OpenExtra(ColladaLibraryGeometriesWriter)

ColladaGeometryWriter ColladaLibraryGeometriesWriter::OpenGeometry()
{
	return ColladaGeometryWriter(GetFileWriter());
}

ColladaLibraryGeometriesWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaLibraryGeometriesWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_LIBRARY_GEOMETRIES);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<library_lights>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetID(ColladaLibraryLightsWriter)
COLLADA_DEFINE_SetName(ColladaLibraryLightsWriter)
COLLADA_DEFINE_OpenAsset(ColladaLibraryLightsWriter)
COLLADA_DEFINE_OpenExtra(ColladaLibraryLightsWriter)

ColladaLightWriter ColladaLibraryLightsWriter::OpenLight()
{
	return ColladaLightWriter(GetFileWriter());
}

ColladaLibraryLightsWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaLibraryLightsWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_LIBRARY_LIGHTS);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<library_nodes>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetID(ColladaLibraryNodesWriter)
COLLADA_DEFINE_SetName(ColladaLibraryNodesWriter)
COLLADA_DEFINE_OpenAsset(ColladaLibraryNodesWriter)
COLLADA_DEFINE_OpenExtra(ColladaLibraryNodesWriter)

ColladaNodeWriter ColladaLibraryNodesWriter::OpenNode()
{
	return ColladaNodeWriter(GetFileWriter());
}

ColladaLibraryNodesWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaLibraryNodesWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_LIBRARY_NODES);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<library_visual_scenes>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetID(ColladaLibraryVisualScenesWriter)
COLLADA_DEFINE_SetName(ColladaLibraryVisualScenesWriter)
COLLADA_DEFINE_OpenAsset(ColladaLibraryVisualScenesWriter)
COLLADA_DEFINE_OpenExtra(ColladaLibraryVisualScenesWriter)

ColladaVisualSceneWriter ColladaLibraryVisualScenesWriter::OpenVisualScene()
{
	return ColladaVisualSceneWriter(GetFileWriter());
}

ColladaLibraryVisualScenesWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaLibraryVisualScenesWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_LIBRARY_VISUAL_SCENES);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<light>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetID(ColladaLightWriter)
COLLADA_DEFINE_SetName(ColladaLightWriter)
COLLADA_DEFINE_OpenAsset(ColladaLightWriter)
COLLADA_DEFINE_OpenTechniqueCore(ColladaLightWriter)
COLLADA_DEFINE_OpenExtra(ColladaLightWriter)

ColladaAmbientCoreWriter ColladaLightWriter::TechniqueCommonWriter::OpenAmbient()
{
	return ColladaAmbientCoreWriter(GetFileWriter());
}

ColladaDirectionalWriter ColladaLightWriter::TechniqueCommonWriter::OpenDirectional()
{
	return ColladaDirectionalWriter(GetFileWriter());
}

ColladaPointWriter ColladaLightWriter::TechniqueCommonWriter::OpenPoint()
{
	return ColladaPointWriter(GetFileWriter());
}

ColladaSpotWriter ColladaLightWriter::TechniqueCommonWriter::OpenSpot()
{
	return ColladaSpotWriter(GetFileWriter());
}

ColladaLightWriter::TechniqueCommonWriter::COLLADA_ELEMENT_CTOR_IMPL(TechniqueCommonWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_TECHNIQUE_COMMON);
}

ColladaLightWriter::TechniqueCommonWriter ColladaLightWriter::OpenTechniqueCommon()
{
	return TechniqueCommonWriter(GetFileWriter());
}

ColladaLightWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaLightWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_LIGHT);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<lines>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetName(ColladaLinesWriter)
COLLADA_DEFINE_AddInputShared(ColladaLinesWriter)
COLLADA_DEFINE_OpenExtra(ColladaLinesWriter)
COLLADA_DEFINE_Indices(ColladaLinesWriter)

void ColladaLinesWriter::SetMaterial(const string& value)
{
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_MATERIAL, value);
}

ColladaLinesWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaLinesWriter, unsigned int count)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_LINES);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_COUNT, count);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<linestrips>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetName(ColladaLineStripsWriter)
COLLADA_DEFINE_AddInputShared(ColladaLineStripsWriter)
COLLADA_DEFINE_OpenExtra(ColladaLineStripsWriter)
COLLADA_DEFINE_Indices(ColladaLineStripsWriter)

void ColladaLineStripsWriter::SetMaterial(const string& value)
{
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_MATERIAL, value);
}

ColladaLineStripsWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaLineStripsWriter, unsigned int count)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_LINESTRIPS);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_COUNT, count);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<mesh>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_OpenExtra(ColladaMeshWriter)

ColladaSourceCoreWriter ColladaMeshWriter::OpenSource(const string& id)
{
	return ColladaSourceCoreWriter(GetFileWriter(), id);
}

ColladaVerticesWriter ColladaMeshWriter::OpenVertices(const string& id)
{
	return ColladaVerticesWriter(GetFileWriter(), id);
}

ColladaLinesWriter ColladaMeshWriter::OpenLines(unsigned int count)
{
	return ColladaLinesWriter(GetFileWriter(), count);
}

ColladaLineStripsWriter ColladaMeshWriter::OpenLineStrips(unsigned int count)
{
	return ColladaLineStripsWriter(GetFileWriter(), count);
}

ColladaPolygonsWriter ColladaMeshWriter::OpenPolygons(unsigned int count)
{
	return ColladaPolygonsWriter(GetFileWriter(), count);
}

ColladaPolyListWriter ColladaMeshWriter::OpenPolyList(unsigned int count)
{
	return ColladaPolyListWriter(GetFileWriter(), count);
}

ColladaTrianglesWriter ColladaMeshWriter::OpenTriangles(unsigned int count)
{
	return ColladaTrianglesWriter(GetFileWriter(), count);
}

ColladaTriFansWriter ColladaMeshWriter::OpenTriFans(unsigned int count)
{
	return ColladaTriFansWriter(GetFileWriter(), count);
}

ColladaTriStripsWriter ColladaMeshWriter::OpenTriStrips(unsigned int count)
{
	return ColladaTriStripsWriter(GetFileWriter(), count);
}

ColladaMeshWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaMeshWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_MESH);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<morph>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_OpenExtra(ColladaMorphWriter)

void ColladaMorphWriter::SetMethod(ColladaMorphMethod::Type value)
{
	switch (value)
	{
		case ColladaMorphMethod::Relative:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_TYPE, ColladaStrings::ENUM_RELATIVE);
			break;
		case ColladaMorphMethod::Normalized:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_TYPE, ColladaStrings::ENUM_NORMALIZED);
			break;
	}
}

ColladaSourceCoreWriter ColladaMorphWriter::OpenSource(const string& id)
{
	return ColladaSourceCoreWriter(GetFileWriter(), id);
}

ColladaTargetsWriter ColladaMorphWriter::OpenTargets()
{
	return ColladaTargetsWriter(GetFileWriter());
}

ColladaMorphWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaMorphWriter, const string& source)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_MORPH);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_SOURCE, source);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<Name_array>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetID(ColladaNameArrayWriter)
COLLADA_DEFINE_SetName(ColladaNameArrayWriter)
COLLADA_DEFINE_OpenExtra(ColladaNameArrayWriter)

void ColladaNameArrayWriter::Append(const string& value)
{
	GetXmlWriter().AddContent(value);
}

ColladaNameArrayWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaNameArrayWriter, unsigned int count)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_NAME_ARRAY);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_COUNT, count);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<newparam>
// -------------------------------------------------------------------------------------------------------------------------------------

void ColladaNewParamWriter::AddValue(int value)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_INT);
	GetXmlWriter().AddContent(value);
	GetXmlWriter().CloseElement();
}

void ColladaNewParamWriter::AddValue(bool value)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_BOOL);
	GetXmlWriter().AddContent(value);
	GetXmlWriter().CloseElement();
}

void ColladaNewParamWriter::AddValue(double value)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_FLOAT);
	GetXmlWriter().AddContent(value);
	GetXmlWriter().CloseElement();
}

void ColladaNewParamWriter::AddValue(const string& value)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_SIDREF);
	GetXmlWriter().AddContent(value);
	GetXmlWriter().CloseElement();
}

ColladaNewParamWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaNewParamWriter, const string& sid)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_NEWPARAM);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_SID, sid);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<newparam> (FX)
// -------------------------------------------------------------------------------------------------------------------------------------

ColladaNewParamFXWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaNewParamFXWriter, const string& sid)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_NEWPARAM);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_SID, sid);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<node>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetID(ColladaNodeWriter)
COLLADA_DEFINE_SetName(ColladaNodeWriter)
COLLADA_DEFINE_SetSID(ColladaNodeWriter)
COLLADA_DEFINE_AddRotate(ColladaNodeWriter)
COLLADA_DEFINE_AddTranslate(ColladaNodeWriter)
COLLADA_DEFINE_OpenAsset(ColladaNodeWriter)
COLLADA_DEFINE_OpenExtra(ColladaNodeWriter)

void ColladaNodeWriter::SetType(ColladaNodeType::Type value)
{
	switch (value)
	{
		case ColladaNodeType::Joint:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_TYPE, ColladaStrings::ENUM_JOINT);
			break;
		case ColladaNodeType::Node:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_TYPE, ColladaStrings::ENUM_NODE);
			break;
	}
}

void ColladaNodeWriter::SetLayer(const string& value)
{
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_LAYER, value);
}

void ColladaNodeWriter::AddLookAt(double posX, double posY, double posZ, double targetX, double targetY, double targetZ, double upX, double upY, double upZ, const string& sid)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_LOOKAT);
	if (!sid.empty()) GetXmlWriter().AddAttribute(ColladaStrings::ATTR_SID, sid);
	GetXmlWriter().AddContent(posX);
	GetXmlWriter().AddContent(posY);
	GetXmlWriter().AddContent(posZ);
	GetXmlWriter().AddContent(targetX);
	GetXmlWriter().AddContent(targetY);
	GetXmlWriter().AddContent(targetZ);
	GetXmlWriter().AddContent(upX);
	GetXmlWriter().AddContent(upY);
	GetXmlWriter().AddContent(upZ);
	GetXmlWriter().CloseElement();
}

void ColladaNodeWriter::AddMatrix(double m11, double m12, double m13, double m14, double m21, double m22, double m23, double m24, double m31, double m32, double m33, double m34, double m41, double m42, double m43, double m44, const string& sid)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_MATRIX);
	if (!sid.empty()) GetXmlWriter().AddAttribute(ColladaStrings::ATTR_SID, sid);
	GetXmlWriter().AddContent(m11);
	GetXmlWriter().AddContent(m12);
	GetXmlWriter().AddContent(m13);
	GetXmlWriter().AddContent(m14);
	GetXmlWriter().AddContent(m21);
	GetXmlWriter().AddContent(m22);
	GetXmlWriter().AddContent(m23);
	GetXmlWriter().AddContent(m24);
	GetXmlWriter().AddContent(m31);
	GetXmlWriter().AddContent(m32);
	GetXmlWriter().AddContent(m33);
	GetXmlWriter().AddContent(m34);
	GetXmlWriter().AddContent(m41);
	GetXmlWriter().AddContent(m42);
	GetXmlWriter().AddContent(m43);
	GetXmlWriter().AddContent(m44);
	GetXmlWriter().CloseElement();
}

void ColladaNodeWriter::AddScale(double x, double y, double z, const string& sid)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_SCALE);
	if (!sid.empty()) GetXmlWriter().AddAttribute(ColladaStrings::ATTR_SID, sid);
	GetXmlWriter().AddContent(x);
	GetXmlWriter().AddContent(y);
	GetXmlWriter().AddContent(z);
	GetXmlWriter().CloseElement();
}

void ColladaNodeWriter::AddSkew(double angle, double axis1X, double axis1Y, double axis1Z, double axis2X, double axis2Y, double axis2Z, const string& sid)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_SKEW);
	if (!sid.empty()) GetXmlWriter().AddAttribute(ColladaStrings::ATTR_SID, sid);
	GetXmlWriter().AddContent(angle);
	GetXmlWriter().AddContent(axis1X);
	GetXmlWriter().AddContent(axis1Y);
	GetXmlWriter().AddContent(axis1Z);
	GetXmlWriter().AddContent(axis2X);
	GetXmlWriter().AddContent(axis2Y);
	GetXmlWriter().AddContent(axis2Z);
	GetXmlWriter().CloseElement();
}

ColladaInstanceCameraWriter ColladaNodeWriter::OpenInstanceCamera(const string& url)
{
	return ColladaInstanceCameraWriter(GetFileWriter(), url);
}

ColladaInstanceControllerWriter ColladaNodeWriter::OpenInstanceController(const string& url)
{
	return ColladaInstanceControllerWriter(GetFileWriter(), url);
}

ColladaInstanceGeometryWriter ColladaNodeWriter::OpenInstanceGeometry(const string& url)
{
	return ColladaInstanceGeometryWriter(GetFileWriter(), url);
}

ColladaInstanceLightWriter ColladaNodeWriter::OpenInstanceLight(const string& url)
{
	return ColladaInstanceLightWriter(GetFileWriter(), url);
}

ColladaInstanceNodeWriter ColladaNodeWriter::OpenInstanceNode(const string& url)
{
	return ColladaInstanceNodeWriter(GetFileWriter(), url);
}

ColladaNodeWriter ColladaNodeWriter::OpenNode()
{
	return ColladaNodeWriter(GetFileWriter());
}

ColladaNodeWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaNodeWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_NODE);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<optics>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_OpenAsset(ColladaOpticsWriter)
COLLADA_DEFINE_OpenTechniqueCore(ColladaOpticsWriter)
COLLADA_DEFINE_OpenExtra(ColladaOpticsWriter)

ColladaOrthographicWriter ColladaOpticsWriter::TechniqueCommonWriter::OpenOrthographic()
{
	return ColladaOrthographicWriter(GetFileWriter());
}

ColladaPerspectiveWriter ColladaOpticsWriter::TechniqueCommonWriter::OpenPerspective()
{
	return ColladaPerspectiveWriter(GetFileWriter());
}

ColladaOpticsWriter::TechniqueCommonWriter::COLLADA_ELEMENT_CTOR_IMPL(TechniqueCommonWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_TECHNIQUE_COMMON);
}

ColladaOpticsWriter::TechniqueCommonWriter ColladaOpticsWriter::OpenTechniqueCommon()
{
	return TechniqueCommonWriter(GetFileWriter());
}

ColladaOpticsWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaOpticsWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_OPTICS);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<orthographic>
// -------------------------------------------------------------------------------------------------------------------------------------

void ColladaOrthographicWriter::AddXMag(double value, const string& sid)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_XMAG);
	if (!sid.empty()) GetXmlWriter().AddAttribute(ColladaStrings::ATTR_SID, sid);
	GetXmlWriter().AddContent(value);
	GetXmlWriter().CloseElement();
}

void ColladaOrthographicWriter::AddYMag(double value, const string& sid)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_YMAG);
	if (!sid.empty()) GetXmlWriter().AddAttribute(ColladaStrings::ATTR_SID, sid);
	GetXmlWriter().AddContent(value);
	GetXmlWriter().CloseElement();
}

void ColladaOrthographicWriter::AddAspectRatio(double value, const string& sid)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_ASPECT_RATIO);
	if (!sid.empty()) GetXmlWriter().AddAttribute(ColladaStrings::ATTR_SID, sid);
	GetXmlWriter().AddContent(value);
	GetXmlWriter().CloseElement();
}

void ColladaOrthographicWriter::AddZNear(double value, const string& sid)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_ZNEAR);
	if (!sid.empty()) GetXmlWriter().AddAttribute(ColladaStrings::ATTR_SID, sid);
	GetXmlWriter().AddContent(value);
	GetXmlWriter().CloseElement();
}

void ColladaOrthographicWriter::AddZFar(double value, const string& sid)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_ZFAR);
	if (!sid.empty()) GetXmlWriter().AddAttribute(ColladaStrings::ATTR_SID, sid);
	GetXmlWriter().AddContent(value);
	GetXmlWriter().CloseElement();
}

ColladaOrthographicWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaOrthographicWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_ORTHOGRAPHIC);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<perspective>
// -------------------------------------------------------------------------------------------------------------------------------------

void ColladaPerspectiveWriter::AddXFov(double value, const string& sid)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_XFOV);
	if (!sid.empty()) GetXmlWriter().AddAttribute(ColladaStrings::ATTR_SID, sid);
	GetXmlWriter().AddContent(value);
	GetXmlWriter().CloseElement();
}

void ColladaPerspectiveWriter::AddYFov(double value, const string& sid)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_YFOV);
	if (!sid.empty()) GetXmlWriter().AddAttribute(ColladaStrings::ATTR_SID, sid);
	GetXmlWriter().AddContent(value);
	GetXmlWriter().CloseElement();
}

void ColladaPerspectiveWriter::AddAspectRatio(double value, const string& sid)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_ASPECT_RATIO);
	if (!sid.empty()) GetXmlWriter().AddAttribute(ColladaStrings::ATTR_SID, sid);
	GetXmlWriter().AddContent(value);
	GetXmlWriter().CloseElement();
}

void ColladaPerspectiveWriter::AddZNear(double value, const string& sid)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_ZNEAR);
	if (!sid.empty()) GetXmlWriter().AddAttribute(ColladaStrings::ATTR_SID, sid);
	GetXmlWriter().AddContent(value);
	GetXmlWriter().CloseElement();
}

void ColladaPerspectiveWriter::AddZFar(double value, const string& sid)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_ZFAR);
	if (!sid.empty()) GetXmlWriter().AddAttribute(ColladaStrings::ATTR_SID, sid);
	GetXmlWriter().AddContent(value);
	GetXmlWriter().CloseElement();
}

ColladaPerspectiveWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaPerspectiveWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_PERSPECTIVE);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<point>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_AddColor(ColladaPointWriter)
COLLADA_DEFINE_AddConstantLinearQuadraticAttenuation(ColladaPointWriter)

ColladaPointWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaPointWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_POINT);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<polygons>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetName(ColladaPolygonsWriter)
COLLADA_DEFINE_AddInputShared(ColladaPolygonsWriter)
COLLADA_DEFINE_OpenExtra(ColladaPolygonsWriter)
COLLADA_DEFINE_Indices(ColladaPolygonsWriter)
COLLADA_DEFINE_Indices(ColladaPolygonsWriter::PolygonHolesWriter)

void ColladaPolygonsWriter::PolygonHolesWriter::BeginHoleIndices()
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_PH);
}

void ColladaPolygonsWriter::PolygonHolesWriter::EndHoleEndices()
{
	GetXmlWriter().CloseElement();
}

ColladaPolygonsWriter::PolygonHolesWriter::COLLADA_ELEMENT_CTOR_IMPL(PolygonHolesWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_PH);
}

void ColladaPolygonsWriter::SetMaterial(const string& value)
{
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_MATERIAL, value);
}

ColladaPolygonsWriter::PolygonHolesWriter ColladaPolygonsWriter::OpenPolygonsWithHoles()
{
	return PolygonHolesWriter(GetFileWriter());
}

ColladaPolygonsWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaPolygonsWriter, unsigned int count)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_POLYGONS);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_COUNT, count);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<polylist>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetName(ColladaPolyListWriter)
COLLADA_DEFINE_AddInputShared(ColladaPolyListWriter)
COLLADA_DEFINE_OpenExtra(ColladaPolyListWriter)
COLLADA_DEFINE_VCount(ColladaPolyListWriter)
COLLADA_DEFINE_Indices(ColladaPolyListWriter)

void ColladaPolyListWriter::SetMaterial(const string& value)
{
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_MATERIAL, value);
}

ColladaPolyListWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaPolyListWriter, unsigned int count)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_POLYLIST);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_COUNT, count);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<sampler>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetID(ColladaSamplerWriter)
COLLADA_DEFINE_AddInputUnshared(ColladaSamplerWriter)

void ColladaSamplerWriter::SetPreBehavior(ColladaSamplerBehavior::Type value)
{
	switch (value)
	{
		case ColladaSamplerBehavior::Undefined:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_PRE_BEHAVIOR, ColladaStrings::ENUM_UNDEFINED);
			break;
		case ColladaSamplerBehavior::Constant:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_PRE_BEHAVIOR, ColladaStrings::ENUM_CONSTANT);
			break;
		case ColladaSamplerBehavior::Gradient:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_PRE_BEHAVIOR, ColladaStrings::ENUM_GRADIENT);
			break;
		case ColladaSamplerBehavior::Cycle:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_PRE_BEHAVIOR, ColladaStrings::ENUM_CYCLE);
			break;
		case ColladaSamplerBehavior::Oscillate:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_PRE_BEHAVIOR, ColladaStrings::ENUM_OSCILLATE);
			break;
		case ColladaSamplerBehavior::CycleRelative:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_PRE_BEHAVIOR, ColladaStrings::ENUM_CYCLE_RELATIVE);
			break;
	}
}

void ColladaSamplerWriter::SetPostBehavior(ColladaSamplerBehavior::Type value)
{
	switch (value)
	{
		case ColladaSamplerBehavior::Undefined:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_POST_BEHAVIOR, ColladaStrings::ENUM_UNDEFINED);
			break;
		case ColladaSamplerBehavior::Constant:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_POST_BEHAVIOR, ColladaStrings::ENUM_CONSTANT);
			break;
		case ColladaSamplerBehavior::Gradient:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_POST_BEHAVIOR, ColladaStrings::ENUM_GRADIENT);
			break;
		case ColladaSamplerBehavior::Cycle:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_POST_BEHAVIOR, ColladaStrings::ENUM_CYCLE);
			break;
		case ColladaSamplerBehavior::Oscillate:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_POST_BEHAVIOR, ColladaStrings::ENUM_OSCILLATE);
			break;
		case ColladaSamplerBehavior::CycleRelative:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_POST_BEHAVIOR, ColladaStrings::ENUM_CYCLE_RELATIVE);
			break;
	}
}

ColladaSamplerWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaSamplerWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_SAMPLER);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<scene>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_OpenExtra(ColladaSceneWriter)

ColladaInstancePhysicsSceneWriter ColladaSceneWriter::OpenInstancePhysicsScene(const string& url)
{
	return ColladaInstancePhysicsSceneWriter(GetFileWriter(), url);
}

ColladaInstanceVisualSceneWriter ColladaSceneWriter::OpenInstanceVisualScene(const string& url)
{
	return ColladaInstanceVisualSceneWriter(GetFileWriter(), url);
}

ColladaInstanceKinematicsSceneWriter ColladaSceneWriter::OpenInstanceKinematicsScene(const string& url)
{
	return ColladaInstanceKinematicsSceneWriter(GetFileWriter(), url);
}

ColladaSceneWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaSceneWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_SCENE);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<setparam>
// -------------------------------------------------------------------------------------------------------------------------------------

ColladaSetParamFXWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaSetParamFXWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_SETPARAM);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<SIDREF_array>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetID(ColladaSIDREFArrayWriter)
COLLADA_DEFINE_SetName(ColladaSIDREFArrayWriter)

void ColladaSIDREFArrayWriter::Append(const string& value)
{
	GetXmlWriter().AddContent(value);
}

ColladaSIDREFArrayWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaSIDREFArrayWriter, unsigned int count)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_SIDREF_ARRAY);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_COUNT, count);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<skeleton>
// -------------------------------------------------------------------------------------------------------------------------------------

void ColladaSkeletonWriter::Append(const string& value)
{
	GetXmlWriter().AddContent(value);
}

ColladaSkeletonWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaSkeletonWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_SKELETON);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<skin>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_OpenExtra(ColladaSkinWriter)

void ColladaSkinWriter::AddBindShapeMatrix(double m11, double m12, double m13, double m14, double m21, double m22, double m23, double m24, double m31, double m32, double m33, double m34, double m41, double m42, double m43, double m44)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_BIND_SHAPE_MATRIX);
	GetXmlWriter().AddContent(m11);
	GetXmlWriter().AddContent(m12);
	GetXmlWriter().AddContent(m13);
	GetXmlWriter().AddContent(m14);
	GetXmlWriter().AddContent(m21);
	GetXmlWriter().AddContent(m22);
	GetXmlWriter().AddContent(m23);
	GetXmlWriter().AddContent(m24);
	GetXmlWriter().AddContent(m31);
	GetXmlWriter().AddContent(m32);
	GetXmlWriter().AddContent(m33);
	GetXmlWriter().AddContent(m34);
	GetXmlWriter().AddContent(m41);
	GetXmlWriter().AddContent(m42);
	GetXmlWriter().AddContent(m43);
	GetXmlWriter().AddContent(m44);
	GetXmlWriter().CloseElement();
}

ColladaSourceCoreWriter ColladaSkinWriter::OpenSource(const string& id)
{
	return ColladaSourceCoreWriter(GetFileWriter(), id);
}

ColladaJointsWriter ColladaSkinWriter::OpenJoints()
{
	return ColladaJointsWriter(GetFileWriter());
}

ColladaVertexWeightsWriter ColladaSkinWriter::OpenVertexWeights(unsigned int count)
{
	return ColladaVertexWeightsWriter(GetFileWriter(), count);
}

ColladaSkinWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaSkinWriter, const string& source)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_SKIN);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_SOURCE, source);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<source> (Core)
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetName(ColladaSourceCoreWriter)
COLLADA_DEFINE_OpenAsset(ColladaSourceCoreWriter)
COLLADA_DEFINE_OpenTechniqueCore(ColladaSourceCoreWriter)
COLLADA_DEFINE_OpenAsset(ColladaSourceCoreWriter::TechniqueCommonWriter)

ColladaSourceCoreWriter::TechniqueCommonWriter::COLLADA_ELEMENT_CTOR_IMPL(TechniqueCommonWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_TECHNIQUE_COMMON);
}

ColladaBoolArrayWriter ColladaSourceCoreWriter::OpenBoolArray(unsigned int count)
{
	return ColladaBoolArrayWriter(GetFileWriter(), count);
}

ColladaFloatArrayWriter ColladaSourceCoreWriter::OpenFloatArray(unsigned int count)
{
	return ColladaFloatArrayWriter(GetFileWriter(), count);
}

ColladaIDREFArrayWriter ColladaSourceCoreWriter::OpenIDREFArray(unsigned int count)
{
	return ColladaIDREFArrayWriter(GetFileWriter(), count);
}

ColladaIntArrayWriter ColladaSourceCoreWriter::OpenIntArray(unsigned int count)
{
	return ColladaIntArrayWriter(GetFileWriter(), count);
}

ColladaNameArrayWriter ColladaSourceCoreWriter::OpenNameArray(unsigned int count)
{
	return ColladaNameArrayWriter(GetFileWriter(), count);
}

ColladaSIDREFArrayWriter ColladaSourceCoreWriter::OpenSIDREFArray(unsigned int count)
{
	return ColladaSIDREFArrayWriter(GetFileWriter(), count);
}

ColladaSourceCoreWriter::TechniqueCommonWriter ColladaSourceCoreWriter::OpenTechniqueCommon()
{
	return TechniqueCommonWriter(GetFileWriter());
}

ColladaSourceCoreWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaSourceCoreWriter, const string& id)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_SOURCE);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_ID, id);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<spline>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_OpenExtra(ColladaSplineWriter)

void ColladaSplineWriter::SetClosed(bool value)
{
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_CLOSED, value);
}

ColladaSourceCoreWriter ColladaSplineWriter::OpenSource(const string& id)
{
	return ColladaSourceCoreWriter(GetFileWriter(), id);
}

ColladaControlVerticesWriter ColladaSplineWriter::OpenControlVertices()
{
	return ColladaControlVerticesWriter(GetFileWriter());
}

ColladaSplineWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaSplineWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_SPLINE);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<spot>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_AddColor(ColladaSpotWriter)
COLLADA_DEFINE_AddConstantLinearQuadraticAttenuation(ColladaSpotWriter)

void ColladaSpotWriter::AddFalloffAngle(double value, const string& sid)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_FALLOFF_ANGLE);
	if (!sid.empty()) GetXmlWriter().AddAttribute(ColladaStrings::ATTR_SID, sid);
	GetXmlWriter().AddContent(value);
	GetXmlWriter().CloseElement();
}

void ColladaSpotWriter::AddFalloffExponent(double value, const string& sid)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_FALLOFF_EXPONENT);
	if (!sid.empty()) GetXmlWriter().AddAttribute(ColladaStrings::ATTR_SID, sid);
	GetXmlWriter().AddContent(value);
	GetXmlWriter().CloseElement();
}

ColladaSpotWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaSpotWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_SPOT);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<targets>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_AddInputUnshared(ColladaTargetsWriter)
COLLADA_DEFINE_OpenExtra(ColladaTargetsWriter)

ColladaTargetsWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaTargetsWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_TARGETS);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<technique> (Core)
// -------------------------------------------------------------------------------------------------------------------------------------

void ColladaTechniqueCoreWriter::SetXmlNamespace(const string& value)
{
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_XMLNS, value);
}

XmlFileWriter* ColladaTechniqueCoreWriter::GetWriter()
{
	return &GetXmlWriter();
}

ColladaTechniqueCoreWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaTechniqueCoreWriter, const string& profile)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_TECHNIQUE);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_PROFILE, profile);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<triangles>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetName(ColladaTrianglesWriter)
COLLADA_DEFINE_AddInputShared(ColladaTrianglesWriter)
COLLADA_DEFINE_OpenExtra(ColladaTrianglesWriter)
COLLADA_DEFINE_Indices(ColladaTrianglesWriter)

void ColladaTrianglesWriter::SetMaterial(const string& value)
{
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_MATERIAL, value);
}

ColladaTrianglesWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaTrianglesWriter, unsigned int count)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_TRIANGLES);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_COUNT, count);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<trifans>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetName(ColladaTriFansWriter)
COLLADA_DEFINE_AddInputShared(ColladaTriFansWriter)
COLLADA_DEFINE_OpenExtra(ColladaTriFansWriter)
COLLADA_DEFINE_Indices(ColladaTriFansWriter)

void ColladaTriFansWriter::SetMaterial(const string& value)
{
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_MATERIAL, value);
}

ColladaTriFansWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaTriFansWriter, unsigned int count)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_TRIFANS);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_COUNT, count);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<tristrips>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetName(ColladaTriStripsWriter)
COLLADA_DEFINE_AddInputShared(ColladaTriStripsWriter)
COLLADA_DEFINE_OpenExtra(ColladaTriStripsWriter)
COLLADA_DEFINE_Indices(ColladaTriStripsWriter)

void ColladaTriStripsWriter::SetMaterial(const string& value)
{
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_MATERIAL, value);
}

ColladaTriStripsWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaTriStripsWriter, unsigned int count)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_TRISTRIPS);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_COUNT, count);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<vertex_weights>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_AddInputShared(ColladaVertexWeightsWriter)
COLLADA_DEFINE_OpenExtra(ColladaVertexWeightsWriter)
COLLADA_DEFINE_VCount(ColladaVertexWeightsWriter)
COLLADA_DEFINE_Indices(ColladaVertexWeightsWriter)

ColladaVertexWeightsWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaVertexWeightsWriter, unsigned int count)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_VERTEX_WEIGHTS);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_COUNT, count);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<vertices>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetName(ColladaVerticesWriter)
COLLADA_DEFINE_AddInputUnshared(ColladaVerticesWriter)
COLLADA_DEFINE_OpenExtra(ColladaVerticesWriter)

ColladaVerticesWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaVerticesWriter, const string& id)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_VERTICES);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_ID, id);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<visual_scene>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetID(ColladaVisualSceneWriter)
COLLADA_DEFINE_SetName(ColladaVisualSceneWriter)
COLLADA_DEFINE_OpenAsset(ColladaVisualSceneWriter)
COLLADA_DEFINE_OpenExtra(ColladaVisualSceneWriter)

ColladaNodeWriter ColladaVisualSceneWriter::OpenNode()
{
	return ColladaNodeWriter(GetFileWriter());
}

ColladaEvaluateSceneWriter ColladaVisualSceneWriter::OpenEvaluateScene()
{
	return ColladaEvaluateSceneWriter(GetFileWriter());
}

ColladaVisualSceneWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaVisualSceneWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_VISUAL_SCENE);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<attachment>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_AddTranslate(ColladaAttachmentWriter)
COLLADA_DEFINE_AddRotate(ColladaAttachmentWriter)
COLLADA_DEFINE_OpenExtra(ColladaAttachmentWriter)

ColladaAttachmentWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaAttachmentWriter, const string& rigidBody)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_ATTACHMENT);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_RIGID_BODY, rigidBody);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<box>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_OpenExtra(ColladaBoxWriter)

void ColladaBoxWriter::AddHalfExtents(double x, double y, double z)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_HALF_EXTENTS);
	GetXmlWriter().AddContent(x);
	GetXmlWriter().AddContent(y);
	GetXmlWriter().AddContent(z);
	GetXmlWriter().CloseElement();
}

ColladaBoxWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaBoxWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_BOX);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<capsule>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_OpenExtra(ColladaCapsuleWriter)

void ColladaCapsuleWriter::AddHeight(double value)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_HEIGHT);
	GetXmlWriter().AddContent(value);
	GetXmlWriter().CloseElement();
}

void ColladaCapsuleWriter::AddRadius(double value)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_RADIUS);
	GetXmlWriter().AddContent(value);
	GetXmlWriter().CloseElement();
}

ColladaCapsuleWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaCapsuleWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_CAPSULE);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<convex_mesh>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_OpenExtra(ColladaConvexMeshWriter)

void ColladaConvexMeshWriter::SetConvexHullOf(const string& value)
{
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_CONVEX_HULL_OF, value);
}

ColladaSourceCoreWriter ColladaConvexMeshWriter::OpenSource(const string& id)
{
	return ColladaSourceCoreWriter(GetFileWriter(), id);
}

ColladaVerticesWriter ColladaConvexMeshWriter::OpenVertices(const string& id)
{
	return ColladaVerticesWriter(GetFileWriter(), id);
}

ColladaLinesWriter ColladaConvexMeshWriter::OpenLines(unsigned int count)
{
	return ColladaLinesWriter(GetFileWriter(), count);
}

ColladaLineStripsWriter ColladaConvexMeshWriter::OpenLineStrips(unsigned int count)
{
	return ColladaLineStripsWriter(GetFileWriter(), count);
}

ColladaPolygonsWriter ColladaConvexMeshWriter::OpenPolygons(unsigned int count)
{
	return ColladaPolygonsWriter(GetFileWriter(), count);
}

ColladaPolyListWriter ColladaConvexMeshWriter::OpenPolyList(unsigned int count)
{
	return ColladaPolyListWriter(GetFileWriter(), count);
}

ColladaTrianglesWriter ColladaConvexMeshWriter::OpenTriangles(unsigned int count)
{
	return ColladaTrianglesWriter(GetFileWriter(), count);
}

ColladaTriFansWriter ColladaConvexMeshWriter::OpenTriFans(unsigned int count)
{
	return ColladaTriFansWriter(GetFileWriter(), count);
}

ColladaTriStripsWriter ColladaConvexMeshWriter::OpenTriStrips(unsigned int count)
{
	return ColladaTriStripsWriter(GetFileWriter(), count);
}

ColladaConvexMeshWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaConvexMeshWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_CONVEX_MESH);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<cylinder>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_OpenExtra(ColladaCylinderWriter)

void ColladaCylinderWriter::AddHeight(double value)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_HEIGHT);
	GetXmlWriter().AddContent(value);
	GetXmlWriter().CloseElement();
}

void ColladaCylinderWriter::AddRadius(double value)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_RADIUS);
	GetXmlWriter().AddContent(value);
	GetXmlWriter().CloseElement();
}

ColladaCylinderWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaCylinderWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_CYLINDER);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<force_field>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetID(ColladaForceFieldWriter)
COLLADA_DEFINE_SetName(ColladaForceFieldWriter)
COLLADA_DEFINE_OpenAsset(ColladaForceFieldWriter)
COLLADA_DEFINE_OpenTechniqueCore(ColladaForceFieldWriter)
COLLADA_DEFINE_OpenExtra(ColladaForceFieldWriter)

ColladaForceFieldWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaForceFieldWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_FORCE_FIELD);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<instance_force_field>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetID(ColladaInstanceForceFieldWriter)
COLLADA_DEFINE_SetName(ColladaInstanceForceFieldWriter)
COLLADA_DEFINE_OpenExtra(ColladaInstanceForceFieldWriter)

ColladaInstanceForceFieldWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaInstanceForceFieldWriter, const string& url)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_INSTANCE_FORCE_FIELD);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_URL, url);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<instance_physics_material>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetSID(ColladaInstancePhysicsMaterialWriter)
COLLADA_DEFINE_SetName(ColladaInstancePhysicsMaterialWriter)
COLLADA_DEFINE_OpenExtra(ColladaInstancePhysicsMaterialWriter)

ColladaInstancePhysicsMaterialWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaInstancePhysicsMaterialWriter, const string& url)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_INSTANCE_PHYSICS_MATERIAL);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_URL, url);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<instance_physics_model>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetSID(ColladaInstancePhysicsModelWriter)
COLLADA_DEFINE_SetName(ColladaInstancePhysicsModelWriter)
COLLADA_DEFINE_OpenExtra(ColladaInstancePhysicsModelWriter)

void ColladaInstancePhysicsModelWriter::SetParent(const string& value)
{
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_PARENT, value);
}

ColladaInstanceForceFieldWriter ColladaInstancePhysicsModelWriter::OpenInstanceForceField(const string& url)
{
	return ColladaInstanceForceFieldWriter(GetFileWriter(), url);
}

ColladaInstanceRigidBodyWriter ColladaInstancePhysicsModelWriter::OpenInstanceRigidBody(const string& body, const string& target)
{
	return ColladaInstanceRigidBodyWriter(GetFileWriter(), body, target);
}

ColladaInstanceRigidConstraintWriter ColladaInstancePhysicsModelWriter::OpenInstanceRigidConstraint(const string& constraint)
{
	return ColladaInstanceRigidConstraintWriter(GetFileWriter(), constraint);
}

ColladaInstancePhysicsModelWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaInstancePhysicsModelWriter, const string& url)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_INSTANCE_PHYSICS_MODEL);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_URL, url);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<instance_physics_scene>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetSID(ColladaInstancePhysicsSceneWriter)
COLLADA_DEFINE_SetName(ColladaInstancePhysicsSceneWriter)
COLLADA_DEFINE_OpenExtra(ColladaInstancePhysicsSceneWriter)

ColladaInstancePhysicsSceneWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaInstancePhysicsSceneWriter, const string& url)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_INSTANCE_PHYSICS_SCENE);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_URL, url);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<instance_rigid_body>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetSID(ColladaInstanceRigidBodyWriter)
COLLADA_DEFINE_SetName(ColladaInstanceRigidBodyWriter)
COLLADA_DEFINE_OpenTechniqueCore(ColladaInstanceRigidBodyWriter)
COLLADA_DEFINE_OpenExtra(ColladaInstanceRigidBodyWriter)
COLLADA_DEFINE_AddTranslate(ColladaInstanceRigidBodyWriter::TechniqueCommonWriter::MassFrameWriter)
COLLADA_DEFINE_AddRotate(ColladaInstanceRigidBodyWriter::TechniqueCommonWriter::MassFrameWriter)

ColladaInstanceRigidBodyWriter::TechniqueCommonWriter::MassFrameWriter::COLLADA_ELEMENT_CTOR_IMPL(MassFrameWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_MASS_FRAME);
}

void ColladaInstanceRigidBodyWriter::TechniqueCommonWriter::AddAngularVelocity(double x, double y, double z)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_ANGULAR_VELOCITY);
	GetXmlWriter().AddContent(x);
	GetXmlWriter().AddContent(y);
	GetXmlWriter().AddContent(z);
	GetXmlWriter().CloseElement();
}

void ColladaInstanceRigidBodyWriter::TechniqueCommonWriter::AddVelocity(double x, double y, double z)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_VELOCITY);
	GetXmlWriter().AddContent(x);
	GetXmlWriter().AddContent(y);
	GetXmlWriter().AddContent(z);
	GetXmlWriter().CloseElement();
}

void ColladaInstanceRigidBodyWriter::TechniqueCommonWriter::AddDynamic(bool value, const string& sid)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_DYNAMIC);
	if (!sid.empty()) GetXmlWriter().AddAttribute(ColladaStrings::ATTR_SID, sid);
	GetXmlWriter().AddContent(value);
	GetXmlWriter().CloseElement();
}

void ColladaInstanceRigidBodyWriter::TechniqueCommonWriter::AddMass(double value, const string& sid)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_MASS);
	if (!sid.empty()) GetXmlWriter().AddAttribute(ColladaStrings::ATTR_SID, sid);
	GetXmlWriter().AddContent(value);
	GetXmlWriter().CloseElement();
}

void ColladaInstanceRigidBodyWriter::TechniqueCommonWriter::AddInertia(double x, double y, double z, const string& sid)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_INERTIA);
	if (!sid.empty()) GetXmlWriter().AddAttribute(ColladaStrings::ATTR_SID, sid);
	GetXmlWriter().AddContent(x);
	GetXmlWriter().AddContent(y);
	GetXmlWriter().AddContent(z);
	GetXmlWriter().CloseElement();
}

ColladaInstanceRigidBodyWriter::TechniqueCommonWriter::MassFrameWriter ColladaInstanceRigidBodyWriter::TechniqueCommonWriter::OpenMassFrame()
{
	return MassFrameWriter(GetFileWriter());
}

ColladaPhysicsMaterialWriter ColladaInstanceRigidBodyWriter::TechniqueCommonWriter::OpenPhysicsMaterial()
{
	return ColladaPhysicsMaterialWriter(GetFileWriter());
}

ColladaInstancePhysicsMaterialWriter ColladaInstanceRigidBodyWriter::TechniqueCommonWriter::OpenInstancePhysicsMaterial(const string& url)
{
	return ColladaInstancePhysicsMaterialWriter(GetFileWriter(), url);
}

ColladaShapeWriter ColladaInstanceRigidBodyWriter::TechniqueCommonWriter::OpenShape()
{
	return ColladaShapeWriter(GetFileWriter());
}

ColladaInstanceRigidBodyWriter::TechniqueCommonWriter::COLLADA_ELEMENT_CTOR_IMPL(TechniqueCommonWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_TECHNIQUE_COMMON);
}

ColladaInstanceRigidBodyWriter::TechniqueCommonWriter ColladaInstanceRigidBodyWriter::OpenTechniqueCommon()
{
	return TechniqueCommonWriter(GetFileWriter());
}

ColladaInstanceRigidBodyWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaInstanceRigidBodyWriter, const string& body, const string& target)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_RIGID_BODY);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_BODY, body);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_TARGET, target);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<instance_rigid_constraint>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetSID(ColladaInstanceRigidConstraintWriter)
COLLADA_DEFINE_SetName(ColladaInstanceRigidConstraintWriter)
COLLADA_DEFINE_OpenExtra(ColladaInstanceRigidConstraintWriter)

ColladaInstanceRigidConstraintWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaInstanceRigidConstraintWriter, const string& constraint)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_RIGID_CONSTRAINT);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_CONSTRAINT, constraint);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<library_force_fields>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetID(ColladaLibraryForceFieldsWriter)
COLLADA_DEFINE_SetName(ColladaLibraryForceFieldsWriter)
COLLADA_DEFINE_OpenAsset(ColladaLibraryForceFieldsWriter)
COLLADA_DEFINE_OpenExtra(ColladaLibraryForceFieldsWriter)

ColladaForceFieldWriter ColladaLibraryForceFieldsWriter::OpenForceField()
{
	return ColladaForceFieldWriter(GetFileWriter());
}

ColladaLibraryForceFieldsWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaLibraryForceFieldsWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_LIBRARY_FORCE_FIELDS);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<library_physics_materials>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetID(ColladaLibraryPhysicsMaterialsWriter)
COLLADA_DEFINE_SetName(ColladaLibraryPhysicsMaterialsWriter)
COLLADA_DEFINE_OpenAsset(ColladaLibraryPhysicsMaterialsWriter)
COLLADA_DEFINE_OpenExtra(ColladaLibraryPhysicsMaterialsWriter)

ColladaPhysicsMaterialWriter ColladaLibraryPhysicsMaterialsWriter::OpenPhysicsMaterial()
{
	return ColladaPhysicsMaterialWriter(GetFileWriter());
}

ColladaLibraryPhysicsMaterialsWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaLibraryPhysicsMaterialsWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_LIBRARY_PHYSICS_MATERIALS);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<library_physics_models>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetID(ColladaLibraryPhysicsModelsWriter)
COLLADA_DEFINE_SetName(ColladaLibraryPhysicsModelsWriter)
COLLADA_DEFINE_OpenAsset(ColladaLibraryPhysicsModelsWriter)
COLLADA_DEFINE_OpenExtra(ColladaLibraryPhysicsModelsWriter)

ColladaPhysicsModelWriter ColladaLibraryPhysicsModelsWriter::OpenPhysicsModel()
{
	return ColladaPhysicsModelWriter(GetFileWriter());
}

ColladaLibraryPhysicsModelsWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaLibraryPhysicsModelsWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_LIBRARY_PHYSICS_MODELS);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<library_physics_scenes>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetID(ColladaLibraryPhysicsScenesWriter)
COLLADA_DEFINE_SetName(ColladaLibraryPhysicsScenesWriter)
COLLADA_DEFINE_OpenAsset(ColladaLibraryPhysicsScenesWriter)
COLLADA_DEFINE_OpenExtra(ColladaLibraryPhysicsScenesWriter)

ColladaPhysicsSceneWriter ColladaLibraryPhysicsScenesWriter::OpenPhysicsScene()
{
	return ColladaPhysicsSceneWriter(GetFileWriter());
}

ColladaLibraryPhysicsScenesWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaLibraryPhysicsScenesWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_LIBRARY_PHYSICS_SCENES);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<physics_material>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetID(ColladaPhysicsMaterialWriter)
COLLADA_DEFINE_SetName(ColladaPhysicsMaterialWriter)
COLLADA_DEFINE_OpenAsset(ColladaPhysicsMaterialWriter)
COLLADA_DEFINE_OpenTechniqueCore(ColladaPhysicsMaterialWriter)
COLLADA_DEFINE_OpenExtra(ColladaPhysicsMaterialWriter)

void ColladaPhysicsMaterialWriter::TechniqueCommonWriter::AddDynamicFriction(double value, const string& sid)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_DYNAMIC_FRICTION);
	if (!sid.empty()) GetXmlWriter().AddAttribute(ColladaStrings::ATTR_SID, sid);
	GetXmlWriter().AddContent(value);
	GetXmlWriter().CloseElement();
}

void ColladaPhysicsMaterialWriter::TechniqueCommonWriter::AddRestitution(double value, const string& sid)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_RESTITUTION);
	if (!sid.empty()) GetXmlWriter().AddAttribute(ColladaStrings::ATTR_SID, sid);
	GetXmlWriter().AddContent(value);
	GetXmlWriter().CloseElement();
}

void ColladaPhysicsMaterialWriter::TechniqueCommonWriter::AddStaticFriction(double value, const string& sid)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_STATIC_FRICTION);
	if (!sid.empty()) GetXmlWriter().AddAttribute(ColladaStrings::ATTR_SID, sid);
	GetXmlWriter().AddContent(value);
	GetXmlWriter().CloseElement();
}

ColladaPhysicsMaterialWriter::TechniqueCommonWriter::COLLADA_ELEMENT_CTOR_IMPL(TechniqueCommonWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_TECHNIQUE_COMMON);
}

ColladaPhysicsMaterialWriter::TechniqueCommonWriter ColladaPhysicsMaterialWriter::OpenTechniqueCommon()
{
	return TechniqueCommonWriter(GetFileWriter());
}

ColladaPhysicsMaterialWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaPhysicsMaterialWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_PHYSICS_MATERIAL);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<physics_model>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetID(ColladaPhysicsModelWriter)
COLLADA_DEFINE_SetName(ColladaPhysicsModelWriter)
COLLADA_DEFINE_OpenAsset(ColladaPhysicsModelWriter)
COLLADA_DEFINE_OpenExtra(ColladaPhysicsModelWriter)

ColladaRigidBodyWriter ColladaPhysicsModelWriter::OpenRigidBody(const string& sid)
{
	return ColladaRigidBodyWriter(GetFileWriter(), sid);
}

ColladaRigidConstraintWriter ColladaPhysicsModelWriter::OpenRigidConstraint(const string& sid)
{
	return ColladaRigidConstraintWriter(GetFileWriter(), sid);
}

ColladaInstancePhysicsModelWriter ColladaPhysicsModelWriter::OpenInstancePhysicsModel(const string& url)
{
	return ColladaInstancePhysicsModelWriter(GetFileWriter(), url);
}

ColladaPhysicsModelWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaPhysicsModelWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_PHYSICS_MODEL);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<physics_scene>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetID(ColladaPhysicsSceneWriter)
COLLADA_DEFINE_SetName(ColladaPhysicsSceneWriter)
COLLADA_DEFINE_OpenAsset(ColladaPhysicsSceneWriter)
COLLADA_DEFINE_OpenTechniqueCore(ColladaPhysicsSceneWriter)
COLLADA_DEFINE_OpenExtra(ColladaPhysicsSceneWriter)

void ColladaPhysicsSceneWriter::TechniqueCommonWriter::AddGravity(double x, double y, double z, const string& sid)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_GRAVITY);
	if (!sid.empty()) GetXmlWriter().AddAttribute(ColladaStrings::ATTR_SID, sid);
	GetXmlWriter().AddContent(x);
	GetXmlWriter().AddContent(y);
	GetXmlWriter().AddContent(z);
	GetXmlWriter().CloseElement();
}

void ColladaPhysicsSceneWriter::TechniqueCommonWriter::AddTimeStep(double value, const string& sid)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_TIME_STEP);
	if (!sid.empty()) GetXmlWriter().AddAttribute(ColladaStrings::ATTR_SID, sid);
	GetXmlWriter().AddContent(value);
	GetXmlWriter().CloseElement();
}

ColladaPhysicsSceneWriter::TechniqueCommonWriter::COLLADA_ELEMENT_CTOR_IMPL(TechniqueCommonWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_TECHNIQUE_COMMON);
}

ColladaInstanceForceFieldWriter ColladaPhysicsSceneWriter::OpenInstanceForceField(const string& url)
{
	return ColladaInstanceForceFieldWriter(GetFileWriter(), url);
}

ColladaInstancePhysicsModelWriter ColladaPhysicsSceneWriter::OpenInstancePhysicsModel(const string& url)
{
	return ColladaInstancePhysicsModelWriter(GetFileWriter(), url);
}

ColladaPhysicsSceneWriter::TechniqueCommonWriter ColladaPhysicsSceneWriter::OpenTechniqueCommon()
{
	return TechniqueCommonWriter(GetFileWriter());
}

ColladaPhysicsSceneWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaPhysicsSceneWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_PHYSICS_SCENE);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<plane>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_OpenExtra(ColladaPlaneWriter)

void ColladaPlaneWriter::AddEquation(double a, double b, double c, double d)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_EQUATION);
	GetXmlWriter().AddContent(a);
	GetXmlWriter().AddContent(b);
	GetXmlWriter().AddContent(c);
	GetXmlWriter().AddContent(d);
	GetXmlWriter().CloseElement();
}

ColladaPlaneWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaPlaneWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_PLANE);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<ref_attachment>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_AddTranslate(ColladaRefAttachmentWriter)
COLLADA_DEFINE_AddRotate(ColladaRefAttachmentWriter)
COLLADA_DEFINE_OpenExtra(ColladaRefAttachmentWriter)

ColladaRefAttachmentWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaRefAttachmentWriter, const string& rigidBody)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_REF_ATTACHMENT);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_RIGID_BODY, rigidBody);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<rigid_body>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetName(ColladaRigidBodyWriter)
COLLADA_DEFINE_SetID(ColladaRigidBodyWriter)
COLLADA_DEFINE_OpenTechniqueCore(ColladaRigidBodyWriter)
COLLADA_DEFINE_OpenExtra(ColladaRigidBodyWriter)

ColladaInstanceRigidBodyWriter::TechniqueCommonWriter ColladaRigidBodyWriter::OpenTechniqueCommon()
{
	return ColladaInstanceRigidBodyWriter::TechniqueCommonWriter(GetFileWriter());
}

ColladaRigidBodyWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaRigidBodyWriter, const string& sid)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_RIGID_BODY);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_SID, sid);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<rigid_constraint>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetName(ColladaRigidConstraintWriter)
COLLADA_DEFINE_OpenTechniqueCore(ColladaRigidConstraintWriter)
COLLADA_DEFINE_OpenExtra(ColladaRigidConstraintWriter)

void ColladaRigidConstraintWriter::TechniqueCommonWriter::LimitsWriter::SwingConeAndTwistOrLinearWriter::AddMin(double x, double y, double z, const string& sid)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_MIN);
	if (!sid.empty()) GetXmlWriter().AddAttribute(ColladaStrings::ATTR_SID, sid);
	GetXmlWriter().AddContent(x);
	GetXmlWriter().AddContent(y);
	GetXmlWriter().AddContent(z);
	GetXmlWriter().CloseElement();
}

void ColladaRigidConstraintWriter::TechniqueCommonWriter::LimitsWriter::SwingConeAndTwistOrLinearWriter::AddMax(double x, double y, double z, const string& sid)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_MAX);
	if (!sid.empty()) GetXmlWriter().AddAttribute(ColladaStrings::ATTR_SID, sid);
	GetXmlWriter().AddContent(x);
	GetXmlWriter().AddContent(y);
	GetXmlWriter().AddContent(z);
	GetXmlWriter().CloseElement();
}

ColladaRigidConstraintWriter::TechniqueCommonWriter::LimitsWriter::SwingConeAndTwistOrLinearWriter::COLLADA_ELEMENT_CTOR_IMPL(SwingConeAndTwistOrLinearWriter, const string& elementName)
{
	GetXmlWriter().OpenElement(elementName);
}

ColladaRigidConstraintWriter::TechniqueCommonWriter::LimitsWriter::SwingConeAndTwistOrLinearWriter ColladaRigidConstraintWriter::TechniqueCommonWriter::LimitsWriter::OpenSwingConeAndTwist()
{
	return SwingConeAndTwistOrLinearWriter(GetFileWriter(), ColladaStrings::ELEM_SWING_CONT_AND_TWIST);
}

ColladaRigidConstraintWriter::TechniqueCommonWriter::LimitsWriter::SwingConeAndTwistOrLinearWriter ColladaRigidConstraintWriter::TechniqueCommonWriter::LimitsWriter::OpenLinear()
{
	return SwingConeAndTwistOrLinearWriter(GetFileWriter(), ColladaStrings::ELEM_LINEAR);
}

ColladaRigidConstraintWriter::TechniqueCommonWriter::LimitsWriter::COLLADA_ELEMENT_CTOR_IMPL(LimitsWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_LIMITS);
}

void ColladaRigidConstraintWriter::TechniqueCommonWriter::SpringWriter::LinearOrAngularWriter::AddStiffness(double value, const string& sid)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_STIFFNESS);
	if (!sid.empty()) GetXmlWriter().AddAttribute(ColladaStrings::ATTR_SID, sid);
	GetXmlWriter().AddContent(value);
	GetXmlWriter().CloseElement();
}

void ColladaRigidConstraintWriter::TechniqueCommonWriter::SpringWriter::LinearOrAngularWriter::AddDamping(double value, const string& sid)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_DAMPING);
	if (!sid.empty()) GetXmlWriter().AddAttribute(ColladaStrings::ATTR_SID, sid);
	GetXmlWriter().AddContent(value);
	GetXmlWriter().CloseElement();
}

void ColladaRigidConstraintWriter::TechniqueCommonWriter::SpringWriter::LinearOrAngularWriter::AddTargetValue(double value, const string& sid)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_TARGET_VALUE);
	if (!sid.empty()) GetXmlWriter().AddAttribute(ColladaStrings::ATTR_SID, sid);
	GetXmlWriter().AddContent(value);
	GetXmlWriter().CloseElement();
}

ColladaRigidConstraintWriter::TechniqueCommonWriter::SpringWriter::LinearOrAngularWriter::COLLADA_ELEMENT_CTOR_IMPL(LinearOrAngularWriter, const string& elementName)
{
	GetXmlWriter().OpenElement(elementName);
}

ColladaRigidConstraintWriter::TechniqueCommonWriter::SpringWriter::LinearOrAngularWriter ColladaRigidConstraintWriter::TechniqueCommonWriter::SpringWriter::OpenLinear()
{
	return LinearOrAngularWriter(GetFileWriter(), ColladaStrings::ELEM_LINEAR);
}

ColladaRigidConstraintWriter::TechniqueCommonWriter::SpringWriter::LinearOrAngularWriter ColladaRigidConstraintWriter::TechniqueCommonWriter::SpringWriter::OpenAngular()
{
	return LinearOrAngularWriter(GetFileWriter(), ColladaStrings::ELEM_ANGULAR);
}

ColladaRigidConstraintWriter::TechniqueCommonWriter::SpringWriter::COLLADA_ELEMENT_CTOR_IMPL(SpringWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_SPRING);
}

void ColladaRigidConstraintWriter::TechniqueCommonWriter::AddEnabled(bool value, const string& sid)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_ENABLED);
	if (!sid.empty()) GetXmlWriter().AddAttribute(ColladaStrings::ATTR_SID, sid);
	GetXmlWriter().AddContent(value);
	GetXmlWriter().CloseElement();
}

void ColladaRigidConstraintWriter::TechniqueCommonWriter::AddInterpenetrate(bool value, const string& sid)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_INTERPENETRATE);
	if (!sid.empty()) GetXmlWriter().AddAttribute(ColladaStrings::ATTR_SID, sid);
	GetXmlWriter().AddContent(value);
	GetXmlWriter().CloseElement();
}

ColladaRigidConstraintWriter::TechniqueCommonWriter::LimitsWriter ColladaRigidConstraintWriter::TechniqueCommonWriter::OpenLimits()
{
	return LimitsWriter(GetFileWriter());
}

ColladaRigidConstraintWriter::TechniqueCommonWriter::SpringWriter ColladaRigidConstraintWriter::TechniqueCommonWriter::OpenSpring()
{
	return SpringWriter(GetFileWriter());
}

ColladaRigidConstraintWriter::TechniqueCommonWriter::COLLADA_ELEMENT_CTOR_IMPL(TechniqueCommonWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_TECHNIQUE_COMMON);
}

ColladaRefAttachmentWriter ColladaRigidConstraintWriter::OpenRefAttachment(const string& rigidBody)
{
	return ColladaRefAttachmentWriter(GetFileWriter(), rigidBody);
}

ColladaAttachmentWriter ColladaRigidConstraintWriter::OpenAttachment(const string& rigidBody)
{
	return ColladaAttachmentWriter(GetFileWriter(), rigidBody);
}

ColladaRigidConstraintWriter::TechniqueCommonWriter ColladaRigidConstraintWriter::OpenTechniqueCommon()
{
	return TechniqueCommonWriter(GetFileWriter());
}

ColladaRigidConstraintWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaRigidConstraintWriter, const string& sid)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_RIGID_CONSTRAINT);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_SID, sid);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<shape>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_AddRotate(ColladaShapeWriter)
COLLADA_DEFINE_AddTranslate(ColladaShapeWriter)
COLLADA_DEFINE_OpenExtra(ColladaShapeWriter)

void ColladaShapeWriter::AddHollow(bool value, const string& sid)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_HOLLOW);
	if (!sid.empty()) GetXmlWriter().AddAttribute(ColladaStrings::ATTR_SID, sid);
	GetXmlWriter().AddContent(value);
	GetXmlWriter().CloseElement();
}

void ColladaShapeWriter::AddMass(double value, const string& sid)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_MASS);
	if (!sid.empty()) GetXmlWriter().AddAttribute(ColladaStrings::ATTR_SID, sid);
	GetXmlWriter().AddContent(value);
	GetXmlWriter().CloseElement();
}

void ColladaShapeWriter::AddDensity(double value, const string& sid)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_DENSITY);
	if (!sid.empty()) GetXmlWriter().AddAttribute(ColladaStrings::ATTR_SID, sid);
	GetXmlWriter().AddContent(value);
	GetXmlWriter().CloseElement();
}

ColladaPhysicsMaterialWriter ColladaShapeWriter::OpenPhysicsMaterial()
{
	return ColladaPhysicsMaterialWriter(GetFileWriter());
}

ColladaInstancePhysicsMaterialWriter ColladaShapeWriter::OpenInstancePhysicsMaterial(const string& url)
{
	return ColladaInstancePhysicsMaterialWriter(GetFileWriter(), url);
}

ColladaPlaneWriter ColladaShapeWriter::OpenPlane()
{
	return ColladaPlaneWriter(GetFileWriter());
}

ColladaBoxWriter ColladaShapeWriter::OpenBox()
{
	return ColladaBoxWriter(GetFileWriter());
}

ColladaSphereWriter ColladaShapeWriter::OpenSphere()
{
	return ColladaSphereWriter(GetFileWriter());
}

ColladaCylinderWriter ColladaShapeWriter::OpenCylinder()
{
	return ColladaCylinderWriter(GetFileWriter());
}

ColladaCapsuleWriter ColladaShapeWriter::OpenCapsule()
{
	return ColladaCapsuleWriter(GetFileWriter());
}

ColladaInstanceGeometryWriter ColladaShapeWriter::OpenInstanceGeometry(const string& url)
{
	return ColladaInstanceGeometryWriter(GetFileWriter(), url);
}

ColladaShapeWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaShapeWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_SHAPE);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<sphere>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_OpenExtra(ColladaSphereWriter)

void ColladaSphereWriter::AddRadius(double value)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_RADIUS);
	GetXmlWriter().AddContent(value);
	GetXmlWriter().CloseElement();
}

ColladaSphereWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaSphereWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_SPHERE);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<alpha>
// -------------------------------------------------------------------------------------------------------------------------------------

void ColladaAlphaWriter::SetOperator(ColladaTexCombinerOperator::Type value)
{
	switch (value)
	{
		case ColladaTexCombinerOperator::Replace:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_OPERATOR, ColladaStrings::ENUM_REPLACE);
			break;
		case ColladaTexCombinerOperator::Modulate:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_OPERATOR, ColladaStrings::ENUM_MODULATE);
			break;
		case ColladaTexCombinerOperator::Decal:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_OPERATOR, ColladaStrings::ENUM_DECAL);
			break;
		case ColladaTexCombinerOperator::Blend:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_OPERATOR, ColladaStrings::ENUM_BLEND);
			break;
		case ColladaTexCombinerOperator::Add:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_OPERATOR, ColladaStrings::ENUM_ADD);
			break;
		case ColladaTexCombinerOperator::AddSigned:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_OPERATOR, ColladaStrings::ENUM_ADD_SIGNED);
			break;
		case ColladaTexCombinerOperator::Interpolate:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_OPERATOR, ColladaStrings::ENUM_INTERPOLATE);
			break;
		case ColladaTexCombinerOperator::Subtract:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_OPERATOR, ColladaStrings::ENUM_SUBTRACT);
			break;
		case ColladaTexCombinerOperator::Dot3Rgb:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_OPERATOR, ColladaStrings::ENUM_DOT3_RGB);
			break;
		case ColladaTexCombinerOperator::Dot3Rgba:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_OPERATOR, ColladaStrings::ENUM_DOT3_RGBA);
			break;
	}
}

void ColladaAlphaWriter::SetScale(float value)
{
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_SCALE, value);
}

void ColladaAlphaWriter::AddArgument(ColladaTexCombinerSource::Type source, ColladaTexCombinerOperand::Type operand, const string& sampler)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_ARGUMENT);
	switch (source)
	{
		case ColladaTexCombinerSource::Texture:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_SOURCE, ColladaStrings::ENUM_TEXTURE);
			break;
		case ColladaTexCombinerSource::Constant:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_SOURCE, ColladaStrings::ENUM_CONSTANT);
			break;
		case ColladaTexCombinerSource::Primary:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_SOURCE, ColladaStrings::ENUM_PRIMARY);
			break;
		case ColladaTexCombinerSource::Previous:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_SOURCE, ColladaStrings::ENUM_PREVIOUS);
			break;
	}
	switch (operand)
	{
		case ColladaTexCombinerOperand::SrcColor:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_OPERAND, ColladaStrings::ENUM_SRC_COLOR);
			break;
		case ColladaTexCombinerOperand::OneMinusSrcColor:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_OPERAND, ColladaStrings::ENUM_ONE_MINUS_SRC_COLOR);
			break;
		case ColladaTexCombinerOperand::SrcAlpha:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_OPERAND, ColladaStrings::ENUM_SRC_ALPHA);
			break;
		case ColladaTexCombinerOperand::OneMinusSrcAlpha:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_OPERAND, ColladaStrings::ENUM_ONE_MINUS_SRC_ALPHA);
			break;
	}
	if (!sampler.empty()) GetXmlWriter().AddAttribute(ColladaStrings::ATTR_SAMPLER, sampler);
	GetXmlWriter().CloseElement();
}

ColladaAlphaWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaAlphaWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_ALPHA);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<annotate>
// -------------------------------------------------------------------------------------------------------------------------------------

void ColladaAnnotateWriter::AddBool(bool x)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_BOOL);
	GetXmlWriter().AddContent(x);
	GetXmlWriter().CloseElement();
}

void ColladaAnnotateWriter::AddBool2(bool x, bool y)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_BOOL2);
	GetXmlWriter().AddContent(x);
	GetXmlWriter().AddContent(y);
	GetXmlWriter().CloseElement();
}

void ColladaAnnotateWriter::AddBool3(bool x, bool y, bool z)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_BOOL3);
	GetXmlWriter().AddContent(x);
	GetXmlWriter().AddContent(y);
	GetXmlWriter().AddContent(z);
	GetXmlWriter().CloseElement();
}

void ColladaAnnotateWriter::AddBool4(bool x, bool y, bool z, bool w)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_BOOL4);
	GetXmlWriter().AddContent(x);
	GetXmlWriter().AddContent(y);
	GetXmlWriter().AddContent(z);
	GetXmlWriter().AddContent(w);
	GetXmlWriter().CloseElement();
}

void ColladaAnnotateWriter::AddInt(int x)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_INT);
	GetXmlWriter().AddContent(x);
	GetXmlWriter().CloseElement();
}

void ColladaAnnotateWriter::AddInt2(int x, int y)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_INT2);
	GetXmlWriter().AddContent(x);
	GetXmlWriter().AddContent(y);
	GetXmlWriter().CloseElement();
}

void ColladaAnnotateWriter::AddInt3(int x, int y, int z)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_INT3);
	GetXmlWriter().AddContent(x);
	GetXmlWriter().AddContent(y);
	GetXmlWriter().AddContent(z);
	GetXmlWriter().CloseElement();
}

void ColladaAnnotateWriter::AddInt4(int x, int y, int z, int w)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_INT4);
	GetXmlWriter().AddContent(x);
	GetXmlWriter().AddContent(y);
	GetXmlWriter().AddContent(z);
	GetXmlWriter().AddContent(w);
	GetXmlWriter().CloseElement();
}

void ColladaAnnotateWriter::AddFloat(float x)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_FLOAT);
	GetXmlWriter().AddContent(x);
	GetXmlWriter().CloseElement();
}

void ColladaAnnotateWriter::AddFloat2(float x, float y)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_FLOAT2);
	GetXmlWriter().AddContent(x);
	GetXmlWriter().AddContent(y);
	GetXmlWriter().CloseElement();
}

void ColladaAnnotateWriter::AddFloat3(float x, float y, float z)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_FLOAT3);
	GetXmlWriter().AddContent(x);
	GetXmlWriter().AddContent(y);
	GetXmlWriter().AddContent(z);
	GetXmlWriter().CloseElement();
}

void ColladaAnnotateWriter::AddFloat4(float x, float y, float z, float w)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_FLOAT4);
	GetXmlWriter().AddContent(x);
	GetXmlWriter().AddContent(y);
	GetXmlWriter().AddContent(z);
	GetXmlWriter().AddContent(w);
	GetXmlWriter().CloseElement();
}

void ColladaAnnotateWriter::AddFloat2x2(float m11, float m12, float m21, float m22)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_FLOAT2X2);
	GetXmlWriter().AddContent(m11);
	GetXmlWriter().AddContent(m12);
	GetXmlWriter().AddContent(m21);
	GetXmlWriter().AddContent(m22);
	GetXmlWriter().CloseElement();
}

void ColladaAnnotateWriter::AddFloat3x3(float m11, float m12, float m13, float m21, float m22, float m23, float m31, float m32, float m33)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_FLOAT3X3);
	GetXmlWriter().AddContent(m11);
	GetXmlWriter().AddContent(m12);
	GetXmlWriter().AddContent(m13);
	GetXmlWriter().AddContent(m21);
	GetXmlWriter().AddContent(m22);
	GetXmlWriter().AddContent(m23);
	GetXmlWriter().AddContent(m31);
	GetXmlWriter().AddContent(m32);
	GetXmlWriter().AddContent(m33);
	GetXmlWriter().CloseElement();
}

void ColladaAnnotateWriter::AddFloat4x4(float m11, float m12, float m13, float m14, float m21, float m22, float m23, float m24, float m31, float m32, float m33, float m34, float m41, float m42, float m43, float m44)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_FLOAT4X4);
	GetXmlWriter().AddContent(m11);
	GetXmlWriter().AddContent(m12);
	GetXmlWriter().AddContent(m13);
	GetXmlWriter().AddContent(m14);
	GetXmlWriter().AddContent(m21);
	GetXmlWriter().AddContent(m22);
	GetXmlWriter().AddContent(m23);
	GetXmlWriter().AddContent(m24);
	GetXmlWriter().AddContent(m31);
	GetXmlWriter().AddContent(m32);
	GetXmlWriter().AddContent(m33);
	GetXmlWriter().AddContent(m34);
	GetXmlWriter().AddContent(m41);
	GetXmlWriter().AddContent(m42);
	GetXmlWriter().AddContent(m43);
	GetXmlWriter().AddContent(m44);
	GetXmlWriter().CloseElement();
}

void ColladaAnnotateWriter::AddString(const string& value)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_STRING);
	GetXmlWriter().AddContent(value);
	GetXmlWriter().CloseElement();
}

ColladaAnnotateWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaAnnotateWriter, const string& name)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_ANNOTATE);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_NAME, name);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<array>
// -------------------------------------------------------------------------------------------------------------------------------------

ColladaArrayWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaArrayWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_ARRAY);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<binary>
// -------------------------------------------------------------------------------------------------------------------------------------

void ColladaBinaryWriter::AddRef(const string& value)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_REF);
	GetXmlWriter().AddContent(value);
	GetXmlWriter().CloseElement();
}

void ColladaBinaryWriter::OpenHex(const string& format)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_HEX);
	if (!format.empty()) GetXmlWriter().AddAttribute(ColladaStrings::ATTR_FORMAT, format);
}

void ColladaBinaryWriter::AppendBytes(unsigned char* values, int count)
{
	GetXmlWriter().AddContent(values, count);
}

void ColladaBinaryWriter::CloseHex()
{
	GetXmlWriter().CloseElement();
}

ColladaBinaryWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaBinaryWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_BINARY);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<bind_material>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_AddParam(ColladaBindMaterialWriter)
COLLADA_DEFINE_OpenTechniqueCore(ColladaBindMaterialWriter)
COLLADA_DEFINE_OpenExtra(ColladaBindMaterialWriter)

ColladaInstanceMaterialGeometryWriter ColladaBindMaterialWriter::TechniqueCommonWriter::OpenInstanceMaterial(const string& target, const string& symbol)
{
	return ColladaInstanceMaterialGeometryWriter(GetFileWriter(), target, symbol);
}

ColladaBindMaterialWriter::TechniqueCommonWriter::COLLADA_ELEMENT_CTOR_IMPL(TechniqueCommonWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_TECHNIQUE_COMMON);
}

ColladaBindMaterialWriter::TechniqueCommonWriter ColladaBindMaterialWriter::OpenTechniqueCommon()
{
	return TechniqueCommonWriter(GetFileWriter());
}

ColladaBindMaterialWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaBindMaterialWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_BIND_MATERIAL);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<bind_uniform>
// -------------------------------------------------------------------------------------------------------------------------------------

ColladaBindUniformWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaBindUniformWriter, const string& symbol)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_BIND_UNIFORM);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_SYMBOL, symbol);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<blinn>
// -------------------------------------------------------------------------------------------------------------------------------------

ColladaFXCommonColorOrTextureWriter ColladaBlinnWriter::OpenEmission()
{
	return ColladaFXCommonColorOrTextureWriter(GetFileWriter(), ColladaStrings::ELEM_EMISSION);
}

ColladaFXCommonColorOrTextureWriter ColladaBlinnWriter::OpenAmbient()
{
	return ColladaFXCommonColorOrTextureWriter(GetFileWriter(), ColladaStrings::ELEM_AMBIENT);
}

ColladaFXCommonColorOrTextureWriter ColladaBlinnWriter::OpenDiffuse()
{
	return ColladaFXCommonColorOrTextureWriter(GetFileWriter(), ColladaStrings::ELEM_DIFFUSE);
}

ColladaFXCommonColorOrTextureWriter ColladaBlinnWriter::OpenSpecular()
{
	return ColladaFXCommonColorOrTextureWriter(GetFileWriter(), ColladaStrings::ELEM_SPECULAR);
}

ColladaFXCommonFloatOrParamWriter ColladaBlinnWriter::OpenShininess()
{
	return ColladaFXCommonFloatOrParamWriter(GetFileWriter(), ColladaStrings::ELEM_SHININESS);
}

ColladaFXCommonColorOrTextureWriter ColladaBlinnWriter::OpenReflective()
{
	return ColladaFXCommonColorOrTextureWriter(GetFileWriter(), ColladaStrings::ELEM_REFLECTIVE);
}

ColladaFXCommonFloatOrParamWriter ColladaBlinnWriter::OpenReflectivity()
{
	return ColladaFXCommonFloatOrParamWriter(GetFileWriter(), ColladaStrings::ELEM_REFLECTIVITY);
}

ColladaFXCommonColorOrTextureWriter ColladaBlinnWriter::OpenTransparent()
{
	return ColladaFXCommonColorOrTextureWriter(GetFileWriter(), ColladaStrings::ELEM_TRANSPARENT);
}

ColladaFXCommonFloatOrParamWriter ColladaBlinnWriter::OpenTransparency()
{
	return ColladaFXCommonFloatOrParamWriter(GetFileWriter(), ColladaStrings::ELEM_TRANSPARENCY);
}

ColladaFXCommonFloatOrParamWriter ColladaBlinnWriter::OpenIndexOfRefraction()
{
	return ColladaFXCommonFloatOrParamWriter(GetFileWriter(), ColladaStrings::ELEM_INDEX_OF_REFRACTION);
}

ColladaBlinnWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaBlinnWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_BLINN);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<color_target>
// -------------------------------------------------------------------------------------------------------------------------------------

void ColladaColorTargetWriter::SetIndex(unsigned int value)
{
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_INDEX, value);
}

void ColladaColorTargetWriter::SetSlice(unsigned int value)
{
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_SLICE, value);
}

void ColladaColorTargetWriter::SetMip(unsigned int value)
{
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_MIP, value);
}

void ColladaColorTargetWriter::SetFace(ColladaCubeFace::Type value)
{
	switch (value)
	{
		case ColladaCubeFace::PositiveX:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_FACE, ColladaStrings::ENUM_POSITIVE_X);
			break;
		case ColladaCubeFace::NegativeX:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_FACE, ColladaStrings::ENUM_NEGATIVE_X);
			break;
		case ColladaCubeFace::PositiveY:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_FACE, ColladaStrings::ENUM_POSITIVE_Y);
			break;
		case ColladaCubeFace::NegativeY:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_FACE, ColladaStrings::ENUM_NEGATIVE_Y);
			break;
		case ColladaCubeFace::PositiveZ:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_FACE, ColladaStrings::ENUM_POSITIVE_Z);
			break;
		case ColladaCubeFace::NegativeZ:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_FACE, ColladaStrings::ENUM_NEGATIVE_Z);
			break;
	}
}

void ColladaColorTargetWriter::AddParam(const string& ref)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_PARAM);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_REF, ref);
	GetXmlWriter().CloseElement();
}

ColladaInstanceImageWriter ColladaColorTargetWriter::OpenInstanceImage(const string& url)
{
	return ColladaInstanceImageWriter::CreateInstanceImage(GetFileWriter(), url);
}

ColladaColorTargetWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaColorTargetWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_COLOR_TARGET);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<compiler>
// -------------------------------------------------------------------------------------------------------------------------------------

void ColladaCompilerWriter::SetTarget(const string& value)
{
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_TARGET, value);
}

void ColladaCompilerWriter::SetOptions(const string& value)
{
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_OPTIONS, value);
}

ColladaBinaryWriter ColladaCompilerWriter::OpenBinary()
{
	return ColladaBinaryWriter(GetFileWriter());
}

ColladaCompilerWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaCompilerWriter, const string& platform)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_COMPILER);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_PLATFORM, platform);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<constant> (FX)
// -------------------------------------------------------------------------------------------------------------------------------------

ColladaFXCommonColorOrTextureWriter ColladaConstantFXWriter::OpenEmission()
{
	return ColladaFXCommonColorOrTextureWriter(GetFileWriter(), ColladaStrings::ELEM_EMISSION);
}

ColladaFXCommonColorOrTextureWriter ColladaConstantFXWriter::OpenReflective()
{
	return ColladaFXCommonColorOrTextureWriter(GetFileWriter(), ColladaStrings::ELEM_REFLECTIVE);
}

ColladaFXCommonFloatOrParamWriter ColladaConstantFXWriter::OpenReflectivity()
{
	return ColladaFXCommonFloatOrParamWriter(GetFileWriter(), ColladaStrings::ELEM_REFLECTIVITY);
}

ColladaFXCommonColorOrTextureWriter ColladaConstantFXWriter::OpenTransparent()
{
	return ColladaFXCommonColorOrTextureWriter(GetFileWriter(), ColladaStrings::ELEM_TRANSPARENT);
}

ColladaFXCommonFloatOrParamWriter ColladaConstantFXWriter::OpenTransparency()
{
	return ColladaFXCommonFloatOrParamWriter(GetFileWriter(), ColladaStrings::ELEM_TRANSPARENCY);
}

ColladaFXCommonFloatOrParamWriter ColladaConstantFXWriter::OpenIndexOfRefraction()
{
	return ColladaFXCommonFloatOrParamWriter(GetFileWriter(), ColladaStrings::ELEM_INDEX_OF_REFRACTION);
}

ColladaConstantFXWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaConstantFXWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_CONSTANT);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<create_2d>
// -------------------------------------------------------------------------------------------------------------------------------------

void ColladaCreate2DWriter::AddSizeExact(unsigned int width, unsigned int height)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_SIZE_EXACT);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_WIDTH, width);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_HEIGHT, height);
	GetXmlWriter().CloseElement();
}

void ColladaCreate2DWriter::AddSizeRatio(double width, double height)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_SIZE_RATIO);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_WIDTH, width);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_HEIGHT, height);
	GetXmlWriter().CloseElement();
}

void ColladaCreate2DWriter::AddMips(unsigned int levels, bool autoGenerate)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_MIPS);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_LEVELS, levels);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_AUTO_GENERATE, autoGenerate);
	GetXmlWriter().CloseElement();
}

void ColladaCreate2DWriter::AddUnnormalized()
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_UNNORMALIZED);
	GetXmlWriter().CloseElement();
}

void ColladaCreate2DWriter::AddArray(unsigned int length, bool resizable)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_ARRAY);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_LENGTH, length);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_RESIZABLE, resizable);
	GetXmlWriter().CloseElement();
}

ColladaFormatWriter ColladaCreate2DWriter::OpenFormat()
{
	return ColladaFormatWriter(GetFileWriter());
}

ColladaInitFromWriter ColladaCreate2DWriter::OpenInitFrom()
{
	return ColladaInitFromWriter(GetFileWriter());
}

ColladaCreate2DWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaCreate2DWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_CREATE_2D);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<create_3d>
// -------------------------------------------------------------------------------------------------------------------------------------

void ColladaCreate3DWriter::AddSize(unsigned int width, unsigned int height, unsigned int depth)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_SIZE);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_WIDTH, width);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_HEIGHT, height);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_DEPTH, depth);
	GetXmlWriter().CloseElement();
}

void ColladaCreate3DWriter::AddMips(unsigned int levels, bool autoGenerate)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_MIPS);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_LEVELS, levels);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_AUTO_GENERATE, autoGenerate);
	GetXmlWriter().CloseElement();
}

void ColladaCreate3DWriter::AddArray(unsigned int length, bool resizable)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_ARRAY);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_LENGTH, length);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_RESIZABLE, resizable);
	GetXmlWriter().CloseElement();
}

ColladaFormatWriter ColladaCreate3DWriter::OpenFormat()
{
	return ColladaFormatWriter(GetFileWriter());
}

ColladaInitFromWriter ColladaCreate3DWriter::OpenInitFrom()
{
	return ColladaInitFromWriter(GetFileWriter());
}

ColladaCreate3DWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaCreate3DWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_CREATE_3D);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<create_cube>
// -------------------------------------------------------------------------------------------------------------------------------------

void ColladaCreateCubeWriter::AddSize(unsigned int width)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_SIZE);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_WIDTH, width);
	GetXmlWriter().CloseElement();
}

void ColladaCreateCubeWriter::AddMips(unsigned int levels, bool autoGenerate)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_MIPS);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_LEVELS, levels);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_AUTO_GENERATE, autoGenerate);
	GetXmlWriter().CloseElement();
}

void ColladaCreateCubeWriter::AddArray(unsigned int length, bool resizable)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_ARRAY);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_LENGTH, length);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_RESIZABLE, resizable);
	GetXmlWriter().CloseElement();
}

ColladaFormatWriter ColladaCreateCubeWriter::OpenFormat()
{
	return ColladaFormatWriter(GetFileWriter());
}

ColladaInitFromWriter ColladaCreateCubeWriter::OpenInitFrom()
{
	return ColladaInitFromWriter(GetFileWriter());
}

ColladaCreateCubeWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaCreateCubeWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_CREATE_CUBE);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<depth_target>
// -------------------------------------------------------------------------------------------------------------------------------------

void ColladaDepthTargetWriter::SetIndex(unsigned int value)
{
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_INDEX, value);
}

void ColladaDepthTargetWriter::SetSlice(unsigned int value)
{
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_SLICE, value);
}

void ColladaDepthTargetWriter::SetMip(unsigned int value)
{
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_MIP, value);
}

void ColladaDepthTargetWriter::SetFace(ColladaCubeFace::Type value)
{
	switch (value)
	{
		case ColladaCubeFace::PositiveX:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_FACE, ColladaStrings::ENUM_POSITIVE_X);
			break;
		case ColladaCubeFace::NegativeX:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_FACE, ColladaStrings::ENUM_NEGATIVE_X);
			break;
		case ColladaCubeFace::PositiveY:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_FACE, ColladaStrings::ENUM_POSITIVE_Y);
			break;
		case ColladaCubeFace::NegativeY:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_FACE, ColladaStrings::ENUM_NEGATIVE_Y);
			break;
		case ColladaCubeFace::PositiveZ:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_FACE, ColladaStrings::ENUM_POSITIVE_Z);
			break;
		case ColladaCubeFace::NegativeZ:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_FACE, ColladaStrings::ENUM_NEGATIVE_Z);
			break;
	}
}

void ColladaDepthTargetWriter::AddParam(const string& ref)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_PARAM);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_REF, ref);
	GetXmlWriter().CloseElement();
}

ColladaInstanceImageWriter ColladaDepthTargetWriter::OpenInstanceImage(const string& url)
{
	return ColladaInstanceImageWriter::CreateInstanceImage(GetFileWriter(), url);
}

ColladaDepthTargetWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaDepthTargetWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_DEPTH_TARGET);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<effect>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetName(ColladaEffectWriter)
COLLADA_DEFINE_OpenAsset(ColladaEffectWriter)
COLLADA_DEFINE_OpenExtra(ColladaEffectWriter)

ColladaAnnotateWriter ColladaEffectWriter::OpenAnnotate(const string& name)
{
	return ColladaAnnotateWriter(GetFileWriter(), name);
}

ColladaNewParamFXWriter ColladaEffectWriter::OpenNewParam(const string& sid)
{
	return ColladaNewParamFXWriter(GetFileWriter(), sid);
}

ColladaProfileBRIDGEWriter ColladaEffectWriter::OpenProfileBRIDGE(const string& url)
{
	return ColladaProfileBRIDGEWriter(GetFileWriter(), url);
}

ColladaProfileCGWriter ColladaEffectWriter::OpenProfileCG()
{
	return ColladaProfileCGWriter(GetFileWriter());
}

ColladaProfileGLESWriter ColladaEffectWriter::OpenProfileGLES()
{
	return ColladaProfileGLESWriter(GetFileWriter());
}

ColladaProfileGLES2Writer ColladaEffectWriter::OpenProfileGLES2(const string& language)
{
	return ColladaProfileGLES2Writer(GetFileWriter(), language);
}

ColladaProfileGLSLWriter ColladaEffectWriter::OpenProfileGLSL()
{
	return ColladaProfileGLSLWriter(GetFileWriter());
}

ColladaProfileCOMMONWriter ColladaEffectWriter::OpenProfileCommon()
{
	return ColladaProfileCOMMONWriter(GetFileWriter());
}

ColladaEffectWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaEffectWriter, const string& id)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_EFFECT);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_ID, id);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<evaluate>
// -------------------------------------------------------------------------------------------------------------------------------------

void ColladaEvaluateWriter::AddColorClear(float r, float g, float b, float a, unsigned int index)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_COLOR_CLEAR);
	if (index != 0) GetXmlWriter().AddAttribute(ColladaStrings::ATTR_INDEX, index);
	GetXmlWriter().AddContent(r);
	GetXmlWriter().AddContent(g);
	GetXmlWriter().AddContent(b);
	GetXmlWriter().AddContent(a);
	GetXmlWriter().CloseElement();
}

void ColladaEvaluateWriter::AddDepthClear(float value, unsigned int index)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_DEPTH_CLEAR);
	if (index != 0) GetXmlWriter().AddAttribute(ColladaStrings::ATTR_INDEX, index);
	GetXmlWriter().AddContent(value);
	GetXmlWriter().CloseElement();
}

void ColladaEvaluateWriter::AddStencilClear(unsigned char value, unsigned int index)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_STENCIL_CLEAR);
	if (index != 0) GetXmlWriter().AddAttribute(ColladaStrings::ATTR_INDEX, index);
	GetXmlWriter().AddContent(value);
	GetXmlWriter().CloseElement();
}

void ColladaEvaluateWriter::AddDraw(ColladaDrawParameter::Type value)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_DRAW);
	switch (value)
	{
		case ColladaDrawParameter::Geometry:
			GetXmlWriter().AddContent(ColladaStrings::ENUM_GEOMETRY);
			break;
		case ColladaDrawParameter::SceneGeometry:
			GetXmlWriter().AddContent(ColladaStrings::ENUM_SCENE_GEOMETRY);
			break;
		case ColladaDrawParameter::SceneImage:
			GetXmlWriter().AddContent(ColladaStrings::ENUM_SCENE_IMAGE);
			break;
		case ColladaDrawParameter::FullScreenQuad:
			GetXmlWriter().AddContent(ColladaStrings::ENUM_FULL_SCREEN_QUAD);
			break;
		case ColladaDrawParameter::FullScreenQuadPlusHalfPixel:
			GetXmlWriter().AddContent(ColladaStrings::ENUM_FULL_SCREEN_QUAD_PLUS_HALF_PIXEL);
			break;
	}
	GetXmlWriter().CloseElement();
}

void ColladaEvaluateWriter::AddDraw(const string& value)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_DRAW);
	GetXmlWriter().AddContent(value);
	GetXmlWriter().CloseElement();
}

ColladaColorTargetWriter ColladaEvaluateWriter::OpenColorTarget()
{
	return ColladaColorTargetWriter(GetFileWriter());
}

ColladaDepthTargetWriter ColladaEvaluateWriter::OpenDepthTarget()
{
	return ColladaDepthTargetWriter(GetFileWriter());
}

ColladaStencilTargetWriter ColladaEvaluateWriter::OpenStencilTarget()
{
	return ColladaStencilTargetWriter(GetFileWriter());
}

ColladaEvaluateWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaEvaluateWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_EVALUATE);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<format>
// -------------------------------------------------------------------------------------------------------------------------------------

void ColladaFormatWriter::AddHint(ColladaFormatChannels::Type channels, ColladaFormatRange::Type range, ColladaFormatPrecision::Type precision, const string& space)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_HINT);
	switch (channels)
	{
		case ColladaFormatChannels::RGB:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_CHANNELS, ColladaStrings::ENUM_RGB);
			break;
		case ColladaFormatChannels::RGBA:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_CHANNELS, ColladaStrings::ENUM_RGBA);
			break;
		case ColladaFormatChannels::RGBE:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_CHANNELS, ColladaStrings::ENUM_RGBE);
			break;
		case ColladaFormatChannels::Luminance:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_CHANNELS, ColladaStrings::ENUM_L);
			break;
		case ColladaFormatChannels::LuminanceAlpha:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_CHANNELS, ColladaStrings::ENUM_LA);
			break;
		case ColladaFormatChannels::Depth:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_CHANNELS, ColladaStrings::ENUM_D);
			break;
	}
	switch (range)
	{
		case ColladaFormatRange::SNorm:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_RANGE, ColladaStrings::ENUM_SNORM);
			break;
		case ColladaFormatRange::UNorm:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_RANGE, ColladaStrings::ENUM_UNORM);
			break;
		case ColladaFormatRange::SInt:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_RANGE, ColladaStrings::ENUM_SINT);
			break;
		case ColladaFormatRange::UInt:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_RANGE, ColladaStrings::ENUM_UINT);
			break;
		case ColladaFormatRange::Float:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_RANGE, ColladaStrings::ENUM_FLOAT);
			break;
	}
	switch (precision)
	{
		case ColladaFormatPrecision::Default:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_PRECISION, ColladaStrings::ENUM_DEFAULT);
			break;
		case ColladaFormatPrecision::Low:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_PRECISION, ColladaStrings::ENUM_LOW);
			break;
		case ColladaFormatPrecision::Mid:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_PRECISION, ColladaStrings::ENUM_MID);
			break;
		case ColladaFormatPrecision::High:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_PRECISION, ColladaStrings::ENUM_HIGH);
			break;
		case ColladaFormatPrecision::Max:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_PRECISION, ColladaStrings::ENUM_MAX);
			break;
	}
	if (!space.empty()) GetXmlWriter().AddAttribute(ColladaStrings::ATTR_SPACE, space);
	GetXmlWriter().CloseElement();
}

void ColladaFormatWriter::AddExact(const string& value)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_EXACT);
	GetXmlWriter().AddContent(value);
	GetXmlWriter().CloseElement();
}

ColladaFormatWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaFormatWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_FORMAT);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<fx_common_color_or_texture_type>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_AddColor(ColladaFXCommonColorOrTextureWriter)
COLLADA_DEFINE_OpenExtra(ColladaFXCommonColorOrTextureWriter::TextureWriter)

ColladaFXCommonColorOrTextureWriter::TextureWriter::COLLADA_ELEMENT_CTOR_IMPL(TextureWriter, const string& texture, const string& texcoord)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_TEXTURE);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_TEXTURE, texture);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_TEXCOORD, texcoord);
}

void ColladaFXCommonColorOrTextureWriter::SetOpaque(ColladaOpaqueMode::Type value)
{
	switch (value)
	{
		case ColladaOpaqueMode::AlphaOne:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_OPAQUE, ColladaStrings::ENUM_A_ONE);
			break;
		case ColladaOpaqueMode::ColorZero:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_OPAQUE, ColladaStrings::ENUM_RGB_ZERO);
			break;
		case ColladaOpaqueMode::AlphaZero:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_OPAQUE, ColladaStrings::ENUM_A_ZERO);
			break;
		case ColladaOpaqueMode::ColorOne:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_OPAQUE, ColladaStrings::ENUM_RGB_ONE);
			break;
	}
}

void ColladaFXCommonColorOrTextureWriter::AddParam(const string& ref)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_PARAM);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_REF, ref);
	GetXmlWriter().CloseElement();
}

ColladaFXCommonColorOrTextureWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaFXCommonColorOrTextureWriter, const string& elementName)
{
	GetXmlWriter().OpenElement(elementName);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<fx_common_float_or_param_type>
// -------------------------------------------------------------------------------------------------------------------------------------

void ColladaFXCommonFloatOrParamWriter::AddFloat(double value, const string& sid)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_FLOAT);
	if (!sid.empty()) GetXmlWriter().AddAttribute(ColladaStrings::ATTR_SID, sid);
	GetXmlWriter().AddContent(value);
	GetXmlWriter().CloseElement();
}

void ColladaFXCommonFloatOrParamWriter::AddParam(const string& ref)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_PARAM);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_REF, ref);
	GetXmlWriter().CloseElement();
}

ColladaFXCommonFloatOrParamWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaFXCommonFloatOrParamWriter, const string& elementName)
{
	GetXmlWriter().OpenElement(elementName);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<fx_sampler_common>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_OpenExtra(ColladaFXSamplerCommonWriter)

void ColladaFXSamplerCommonWriter::AddTexcoord(const string& semantic)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_TEXCOORD);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_SEMANTIC, semantic);
	GetXmlWriter().CloseElement();
}

void ColladaFXSamplerCommonWriter::AddWrapS(ColladaTextureWrapMode::Type value)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_WRAP_S);
	switch (value)
	{
		case ColladaTextureWrapMode::Wrap:
			GetXmlWriter().AddContent(ColladaStrings::ENUM_WRAP);
			break;
		case ColladaTextureWrapMode::Mirror:
			GetXmlWriter().AddContent(ColladaStrings::ENUM_MIRROR);
			break;
		case ColladaTextureWrapMode::Clamp:
			GetXmlWriter().AddContent(ColladaStrings::ENUM_CLAMP);
			break;
		case ColladaTextureWrapMode::Border:
			GetXmlWriter().AddContent(ColladaStrings::ENUM_BORDER);
			break;
		case ColladaTextureWrapMode::MirrorOnce:
			GetXmlWriter().AddContent(ColladaStrings::ENUM_MIRROR_ONCE);
			break;
	}
	GetXmlWriter().CloseElement();
}

void ColladaFXSamplerCommonWriter::AddWrapT(ColladaTextureWrapMode::Type value)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_WRAP_T);
	switch (value)
	{
		case ColladaTextureWrapMode::Wrap:
			GetXmlWriter().AddContent(ColladaStrings::ENUM_WRAP);
			break;
		case ColladaTextureWrapMode::Mirror:
			GetXmlWriter().AddContent(ColladaStrings::ENUM_MIRROR);
			break;
		case ColladaTextureWrapMode::Clamp:
			GetXmlWriter().AddContent(ColladaStrings::ENUM_CLAMP);
			break;
		case ColladaTextureWrapMode::Border:
			GetXmlWriter().AddContent(ColladaStrings::ENUM_BORDER);
			break;
		case ColladaTextureWrapMode::MirrorOnce:
			GetXmlWriter().AddContent(ColladaStrings::ENUM_MIRROR_ONCE);
			break;
	}
	GetXmlWriter().CloseElement();
}

void ColladaFXSamplerCommonWriter::AddWrapP(ColladaTextureWrapMode::Type value)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_WRAP_P);
	switch (value)
	{
		case ColladaTextureWrapMode::Wrap:
			GetXmlWriter().AddContent(ColladaStrings::ENUM_WRAP);
			break;
		case ColladaTextureWrapMode::Mirror:
			GetXmlWriter().AddContent(ColladaStrings::ENUM_MIRROR);
			break;
		case ColladaTextureWrapMode::Clamp:
			GetXmlWriter().AddContent(ColladaStrings::ENUM_CLAMP);
			break;
		case ColladaTextureWrapMode::Border:
			GetXmlWriter().AddContent(ColladaStrings::ENUM_BORDER);
			break;
		case ColladaTextureWrapMode::MirrorOnce:
			GetXmlWriter().AddContent(ColladaStrings::ENUM_MIRROR_ONCE);
			break;
	}
	GetXmlWriter().CloseElement();
}

void ColladaFXSamplerCommonWriter::AddMinFilter(ColladaTextureFilter::Type value)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_MINFILTER);
	switch (value)
	{
		case ColladaTextureFilter::None:
			GetXmlWriter().AddContent(ColladaStrings::ENUM_NONE);
			break;
		case ColladaTextureFilter::Nearest:
			GetXmlWriter().AddContent(ColladaStrings::ENUM_NEAREST);
			break;
		case ColladaTextureFilter::Linear:
			GetXmlWriter().AddContent(ColladaStrings::ENUM_LINEAR);
			break;
		case ColladaTextureFilter::Anisotropic:
			GetXmlWriter().AddContent(ColladaStrings::ENUM_ANISOTROPIC);
			break;
	}
	GetXmlWriter().CloseElement();
}

void ColladaFXSamplerCommonWriter::AddMagFilter(ColladaTextureFilter::Type value)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_MAGFILTER);
	switch (value)
	{
		case ColladaTextureFilter::None:
			GetXmlWriter().AddContent(ColladaStrings::ENUM_NONE);
			break;
		case ColladaTextureFilter::Nearest:
			GetXmlWriter().AddContent(ColladaStrings::ENUM_NEAREST);
			break;
		case ColladaTextureFilter::Linear:
			GetXmlWriter().AddContent(ColladaStrings::ENUM_LINEAR);
			break;
		case ColladaTextureFilter::Anisotropic:
			GetXmlWriter().AddContent(ColladaStrings::ENUM_ANISOTROPIC);
			break;
	}
	GetXmlWriter().CloseElement();
}

void ColladaFXSamplerCommonWriter::AddMipFilter(ColladaTextureFilter::Type value)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_MIPFILTER);
	switch (value)
	{
		case ColladaTextureFilter::None:
			GetXmlWriter().AddContent(ColladaStrings::ENUM_NONE);
			break;
		case ColladaTextureFilter::Nearest:
			GetXmlWriter().AddContent(ColladaStrings::ENUM_NEAREST);
			break;
		case ColladaTextureFilter::Linear:
			GetXmlWriter().AddContent(ColladaStrings::ENUM_LINEAR);
			break;
		case ColladaTextureFilter::Anisotropic:
			GetXmlWriter().AddContent(ColladaStrings::ENUM_ANISOTROPIC);
			break;
	}
	GetXmlWriter().CloseElement();
}

void ColladaFXSamplerCommonWriter::AddBorderColor(double r, double g, double b, double a)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_BORDER_COLOR);
	GetXmlWriter().AddContent(r);
	GetXmlWriter().AddContent(g);
	GetXmlWriter().AddContent(b);
	GetXmlWriter().AddContent(a);
	GetXmlWriter().CloseElement();
}

void ColladaFXSamplerCommonWriter::AddMipMaxLevel(unsigned char value)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_MIP_MAX_LEVEL);
	GetXmlWriter().AddContent(value);
	GetXmlWriter().CloseElement();
}

void ColladaFXSamplerCommonWriter::AddMipMinLevel(unsigned char value)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_MIP_MIN_LEVEL);
	GetXmlWriter().AddContent(value);
	GetXmlWriter().CloseElement();
}

void ColladaFXSamplerCommonWriter::AddMipBias(float value)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_MIP_BIAS);
	GetXmlWriter().AddContent(value);
	GetXmlWriter().CloseElement();
}

void ColladaFXSamplerCommonWriter::AddMaxAnisotropy(unsigned int value)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_MAX_ANISOTROPY);
	GetXmlWriter().AddContent(value);
	GetXmlWriter().CloseElement();
}

ColladaInstanceImageWriter ColladaFXSamplerCommonWriter::OpenInstanceImage(const string& url)
{
	return ColladaInstanceImageWriter::CreateInstanceImage(GetFileWriter(), url);
}

ColladaFXSamplerCommonWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaFXSamplerCommonWriter, const string& elementName)
{
	GetXmlWriter().OpenElement(elementName);
}

ColladaFXSamplerCommonWriter ColladaFXSamplerCommonWriter::CreateSampler1D(ColladaFileWriter& writer)
{
	return ColladaFXSamplerCommonWriter(writer, ColladaStrings::ELEM_SAMPLER1D);
}

ColladaFXSamplerCommonWriter ColladaFXSamplerCommonWriter::CreateSampler2D(ColladaFileWriter& writer)
{
	return ColladaFXSamplerCommonWriter(writer, ColladaStrings::ELEM_SAMPLER2D);
}

ColladaFXSamplerCommonWriter ColladaFXSamplerCommonWriter::CreateSampler3D(ColladaFileWriter& writer)
{
	return ColladaFXSamplerCommonWriter(writer, ColladaStrings::ELEM_SAMPLER3D);
}

ColladaFXSamplerCommonWriter ColladaFXSamplerCommonWriter::CreateSamplerCUBE(ColladaFileWriter& writer)
{
	return ColladaFXSamplerCommonWriter(writer, ColladaStrings::ELEM_SAMPLERCUBE);
}

ColladaFXSamplerCommonWriter ColladaFXSamplerCommonWriter::CreateSamplerDEPTH(ColladaFileWriter& writer)
{
	return ColladaFXSamplerCommonWriter(writer, ColladaStrings::ELEM_SAMPLERDEPTH);
}

ColladaFXSamplerCommonWriter ColladaFXSamplerCommonWriter::CreateSamplerRECT(ColladaFileWriter& writer)
{
	return ColladaFXSamplerCommonWriter(writer, ColladaStrings::ELEM_SAMPLERRECT);
}

ColladaFXSamplerCommonWriter ColladaFXSamplerCommonWriter::CreateSamplerStates(ColladaFileWriter& writer)
{
	return ColladaFXSamplerCommonWriter(writer, ColladaStrings::ELEM_SAMPLER_STATES);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<image>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetID(ColladaImageWriter)
COLLADA_DEFINE_SetSID(ColladaImageWriter)
COLLADA_DEFINE_SetName(ColladaImageWriter)
COLLADA_DEFINE_OpenAsset(ColladaImageWriter)
COLLADA_DEFINE_OpenExtra(ColladaImageWriter)

void ColladaImageWriter::AddRenderable(bool share)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_RENDERABLE);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_SHARE, share);
	GetXmlWriter().CloseElement();
}

ColladaInitFromWriter ColladaImageWriter::OpenInitFrom()
{
	return ColladaInitFromWriter(GetFileWriter());
}

ColladaCreate2DWriter ColladaImageWriter::OpenCreate2D()
{
	return ColladaCreate2DWriter(GetFileWriter());
}

ColladaCreate3DWriter ColladaImageWriter::OpenCreate3D()
{
	return ColladaCreate3DWriter(GetFileWriter());
}

ColladaCreateCubeWriter ColladaImageWriter::OpenCreateCube()
{
	return ColladaCreateCubeWriter(GetFileWriter());
}

ColladaImageWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaImageWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_IMAGE);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<init_from>
// -------------------------------------------------------------------------------------------------------------------------------------

void ColladaInitFromWriter::SetMipsGenerate(bool value)
{
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_MIPS_GENERATE, value);
}

void ColladaInitFromWriter::SetArrayIndex(unsigned int value)
{
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_ARRAY_INDEX, value);
}

void ColladaInitFromWriter::AddRef(const string& value)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_REF);
	GetXmlWriter().AddContent(value);
	GetXmlWriter().CloseElement();
}

void ColladaInitFromWriter::OpenHex(const string& format)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_HEX);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_FORMAT, format);
}

void ColladaInitFromWriter::AppendBytes(unsigned char* values, int count)
{
	GetXmlWriter().AddContent(values, count);
}

void ColladaInitFromWriter::CloseHex()
{
	GetXmlWriter().CloseElement();
}

ColladaInitFromWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaInitFromWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_INIT_FROM);
}

ColladaInitFromWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaInitFromWriter, unsigned int mipIndex)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_INIT_FROM);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_MIP_INDEX, mipIndex);
}

ColladaInitFromWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaInitFromWriter, unsigned int mipIndex, unsigned int depth)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_INIT_FROM);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_MIP_INDEX, mipIndex);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_DEPTH, depth);
}

ColladaInitFromWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaInitFromWriter, unsigned int mipIndex, ColladaCubeFace::Type face)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_INIT_FROM);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_MIP_INDEX, mipIndex);
	switch (face)
	{
		case ColladaCubeFace::PositiveX:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_FACE, ColladaStrings::ENUM_POSITIVE_X);
			break;
		case ColladaCubeFace::NegativeX:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_FACE, ColladaStrings::ENUM_NEGATIVE_X);
			break;
		case ColladaCubeFace::PositiveY:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_FACE, ColladaStrings::ENUM_POSITIVE_Y);
			break;
		case ColladaCubeFace::NegativeY:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_FACE, ColladaStrings::ENUM_NEGATIVE_Y);
			break;
		case ColladaCubeFace::PositiveZ:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_FACE, ColladaStrings::ENUM_POSITIVE_Z);
			break;
		case ColladaCubeFace::NegativeZ:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_FACE, ColladaStrings::ENUM_NEGATIVE_Z);
			break;
	}
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<instance_effect>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetSID(ColladaInstanceEffectWriter)
COLLADA_DEFINE_SetName(ColladaInstanceEffectWriter)
COLLADA_DEFINE_OpenExtra(ColladaInstanceEffectWriter)

void ColladaInstanceEffectWriter::AddTechniqueHint(const string& ref, const string& platform, const string& profile)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_TECHNIQUE_HINT);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_REF, ref);
	if (!platform.empty()) GetXmlWriter().AddAttribute(ColladaStrings::ATTR_PLATFORM, platform);
	if (!profile.empty()) GetXmlWriter().AddAttribute(ColladaStrings::ATTR_PROFILE, profile);
	GetXmlWriter().CloseElement();
}

ColladaSetParamFXWriter ColladaInstanceEffectWriter::OpenSetParam()
{
	return ColladaSetParamFXWriter(GetFileWriter());
}

ColladaInstanceEffectWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaInstanceEffectWriter, const string url)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_INSTANCE_EFFECT);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_URL, url);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<instance_image>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetSID(ColladaInstanceImageWriter)
COLLADA_DEFINE_SetName(ColladaInstanceImageWriter)
COLLADA_DEFINE_OpenExtra(ColladaInstanceImageWriter)

ColladaInstanceImageWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaInstanceImageWriter, const string& elementName, const string& url)
{
	GetXmlWriter().OpenElement(elementName);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_URL, url);
}

ColladaInstanceImageWriter ColladaInstanceImageWriter::CreateInstanceImage(ColladaFileWriter& writer, const string& url)
{
	return ColladaInstanceImageWriter(writer, ColladaStrings::ELEM_INSTANCE_IMAGE, url);
}

ColladaInstanceImageWriter ColladaInstanceImageWriter::CreateSamplerImage(ColladaFileWriter& writer, const string& url)
{
	return ColladaInstanceImageWriter(writer, ColladaStrings::ELEM_SAMPLER_IMAGE, url);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<instance_material> (geometry)
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetSID(ColladaInstanceMaterialGeometryWriter)
COLLADA_DEFINE_SetName(ColladaInstanceMaterialGeometryWriter)
COLLADA_DEFINE_OpenExtra(ColladaInstanceMaterialGeometryWriter)

void ColladaInstanceMaterialGeometryWriter::AddBind(const string& semantic, const string& target)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_BIND);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_SEMANTIC, semantic);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_TARGET, target);
	GetXmlWriter().CloseElement();
}

void ColladaInstanceMaterialGeometryWriter::AddBindVertexInput(const string& semantic, const string& inputSemantic, unsigned int inputSet)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_BIND_VERTEX_INPUT);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_SEMANTIC, semantic);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_INPUT_SEMANTIC, inputSemantic);
	if (inputSet >= 0) GetXmlWriter().AddAttribute(ColladaStrings::ATTR_INPUT_SET, inputSet);
	GetXmlWriter().CloseElement();
}

ColladaInstanceMaterialGeometryWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaInstanceMaterialGeometryWriter, const string& target, const string& symbol)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_INSTANCE_MATERIAL);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_TARGET, target);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_SYMBOL, symbol);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<instance_material> (rendering)
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_OpenExtra(ColladaInstanceMaterialRenderingWriter)

void ColladaInstanceMaterialRenderingWriter::AddTechniqueOverride(const string& ref, const string& pass)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_TECHNIQUE_OVERRIDE);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_REF, ref);
	if (!pass.empty()) GetXmlWriter().AddAttribute(ColladaStrings::ATTR_PASS, pass);
	GetXmlWriter().CloseElement();
}

void ColladaInstanceMaterialRenderingWriter::AddBind(const string& semantic, const string& target)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_BIND);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_SEMANTIC, semantic);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_TARGET, target);
	GetXmlWriter().CloseElement();
}

ColladaInstanceMaterialRenderingWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaInstanceMaterialRenderingWriter, const string& url)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_INSTANCE_MATERIAL);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_URL, url);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<lambert>
// -------------------------------------------------------------------------------------------------------------------------------------

ColladaFXCommonColorOrTextureWriter ColladaLambertWriter::OpenEmission()
{
	return ColladaFXCommonColorOrTextureWriter(GetFileWriter(), ColladaStrings::ELEM_EMISSION);
}

ColladaFXCommonColorOrTextureWriter ColladaLambertWriter::OpenAmbient()
{
	return ColladaFXCommonColorOrTextureWriter(GetFileWriter(), ColladaStrings::ELEM_AMBIENT);
}

ColladaFXCommonColorOrTextureWriter ColladaLambertWriter::OpenDiffuse()
{
	return ColladaFXCommonColorOrTextureWriter(GetFileWriter(), ColladaStrings::ELEM_DIFFUSE);
}

ColladaFXCommonColorOrTextureWriter ColladaLambertWriter::OpenReflective()
{
	return ColladaFXCommonColorOrTextureWriter(GetFileWriter(), ColladaStrings::ELEM_REFLECTIVE);
}

ColladaFXCommonFloatOrParamWriter ColladaLambertWriter::OpenReflectivity()
{
	return ColladaFXCommonFloatOrParamWriter(GetFileWriter(), ColladaStrings::ELEM_REFLECTIVITY);
}

ColladaFXCommonColorOrTextureWriter ColladaLambertWriter::OpenTransparent()
{
	return ColladaFXCommonColorOrTextureWriter(GetFileWriter(), ColladaStrings::ELEM_TRANSPARENT);
}

ColladaFXCommonFloatOrParamWriter ColladaLambertWriter::OpenTransparency()
{
	return ColladaFXCommonFloatOrParamWriter(GetFileWriter(), ColladaStrings::ELEM_TRANSPARENCY);
}

ColladaFXCommonFloatOrParamWriter ColladaLambertWriter::OpenIndexOfRefraction()
{
	return ColladaFXCommonFloatOrParamWriter(GetFileWriter(), ColladaStrings::ELEM_INDEX_OF_REFRACTION);
}

ColladaLambertWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaLambertWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_LAMBERT);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<library_effects>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetID(ColladaLibraryEffectsWriter)
COLLADA_DEFINE_SetName(ColladaLibraryEffectsWriter)
COLLADA_DEFINE_OpenAsset(ColladaLibraryEffectsWriter)
COLLADA_DEFINE_OpenExtra(ColladaLibraryEffectsWriter)

ColladaEffectWriter ColladaLibraryEffectsWriter::OpenEffect(const string& id)
{
	return ColladaEffectWriter(GetFileWriter(), id);
}

ColladaLibraryEffectsWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaLibraryEffectsWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_LIBRARY_EFFECTS);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<library_images>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetID(ColladaLibraryImagesWriter)
COLLADA_DEFINE_SetName(ColladaLibraryImagesWriter)
COLLADA_DEFINE_OpenAsset(ColladaLibraryImagesWriter)
COLLADA_DEFINE_OpenExtra(ColladaLibraryImagesWriter)

ColladaImageWriter ColladaLibraryImagesWriter::OpenImage()
{
	return ColladaImageWriter(GetFileWriter());
}

ColladaLibraryImagesWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaLibraryImagesWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_LIBRARY_IMAGES);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<library_materials>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetID(ColladaLibraryMaterialsWriter)
COLLADA_DEFINE_SetName(ColladaLibraryMaterialsWriter)
COLLADA_DEFINE_OpenAsset(ColladaLibraryMaterialsWriter)
COLLADA_DEFINE_OpenExtra(ColladaLibraryMaterialsWriter)

ColladaMaterialWriter ColladaLibraryMaterialsWriter::OpenMaterial()
{
	return ColladaMaterialWriter(GetFileWriter());
}

ColladaLibraryMaterialsWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaLibraryMaterialsWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_LIBRARY_MATERIALS);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<linker>
// -------------------------------------------------------------------------------------------------------------------------------------

void ColladaLinkerWriter::SetTarget(const string& value)
{
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_TARGET, value);
}

void ColladaLinkerWriter::SetOptions(const string& value)
{
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_OPTIONS, value);
}

ColladaBinaryWriter ColladaLinkerWriter::OpenBinary()
{
	return ColladaBinaryWriter(GetFileWriter());
}

ColladaLinkerWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaLinkerWriter, const string& platform)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_LINKER);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_PLATFORM, platform);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<material>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetID(ColladaMaterialWriter)
COLLADA_DEFINE_SetName(ColladaMaterialWriter)
COLLADA_DEFINE_OpenAsset(ColladaMaterialWriter)
COLLADA_DEFINE_OpenExtra(ColladaMaterialWriter)

ColladaInstanceEffectWriter ColladaMaterialWriter::OpenInstanceEffect(const string& url)
{
	return ColladaInstanceEffectWriter(GetFileWriter(), url);
}

ColladaMaterialWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaMaterialWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_MATERIAL);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<pass>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetSID(ColladaPassWriter)
COLLADA_DEFINE_OpenExtra(ColladaPassWriter)

ColladaAnnotateWriter ColladaPassWriter::OpenAnnotate(const string& name)
{
	return ColladaAnnotateWriter(GetFileWriter(), name);
}

ColladaStatesWriter ColladaPassWriter::OpenStates()
{
	return ColladaStatesWriter(GetFileWriter());
}

ColladaProgramWriter ColladaPassWriter::OpenProgram()
{
	return ColladaProgramWriter(GetFileWriter());
}

ColladaEvaluateWriter ColladaPassWriter::OpenEvaluate()
{
	return ColladaEvaluateWriter(GetFileWriter());
}

ColladaPassWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaPassWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_PASS);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<phong>
// -------------------------------------------------------------------------------------------------------------------------------------

ColladaFXCommonColorOrTextureWriter ColladaPhongWriter::OpenEmission()
{
	return ColladaFXCommonColorOrTextureWriter(GetFileWriter(), ColladaStrings::ELEM_EMISSION);
}

ColladaFXCommonColorOrTextureWriter ColladaPhongWriter::OpenAmbient()
{
	return ColladaFXCommonColorOrTextureWriter(GetFileWriter(), ColladaStrings::ELEM_AMBIENT);
}

ColladaFXCommonColorOrTextureWriter ColladaPhongWriter::OpenDiffuse()
{
	return ColladaFXCommonColorOrTextureWriter(GetFileWriter(), ColladaStrings::ELEM_DIFFUSE);
}

ColladaFXCommonColorOrTextureWriter ColladaPhongWriter::OpenSpecular()
{
	return ColladaFXCommonColorOrTextureWriter(GetFileWriter(), ColladaStrings::ELEM_SPECULAR);
}

ColladaFXCommonFloatOrParamWriter ColladaPhongWriter::OpenShininess()
{
	return ColladaFXCommonFloatOrParamWriter(GetFileWriter(), ColladaStrings::ELEM_SHININESS);
}

ColladaFXCommonColorOrTextureWriter ColladaPhongWriter::OpenReflective()
{
	return ColladaFXCommonColorOrTextureWriter(GetFileWriter(), ColladaStrings::ELEM_REFLECTIVE);
}

ColladaFXCommonFloatOrParamWriter ColladaPhongWriter::OpenReflectivity()
{
	return ColladaFXCommonFloatOrParamWriter(GetFileWriter(), ColladaStrings::ELEM_REFLECTIVITY);
}

ColladaFXCommonColorOrTextureWriter ColladaPhongWriter::OpenTransparent()
{
	return ColladaFXCommonColorOrTextureWriter(GetFileWriter(), ColladaStrings::ELEM_TRANSPARENT);
}

ColladaFXCommonFloatOrParamWriter ColladaPhongWriter::OpenTransparency()
{
	return ColladaFXCommonFloatOrParamWriter(GetFileWriter(), ColladaStrings::ELEM_TRANSPARENCY);
}

ColladaFXCommonFloatOrParamWriter ColladaPhongWriter::OpenIndexOfRefraction()
{
	return ColladaFXCommonFloatOrParamWriter(GetFileWriter(), ColladaStrings::ELEM_INDEX_OF_REFRACTION);
}

ColladaPhongWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaPhongWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_PHONG);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<profile_BRIDGE>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetID(ColladaProfileBRIDGEWriter)
COLLADA_DEFINE_OpenAsset(ColladaProfileBRIDGEWriter)
COLLADA_DEFINE_OpenExtra(ColladaProfileBRIDGEWriter)

void ColladaProfileBRIDGEWriter::SetPlatform(const string& value)
{
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_PLATFORM, value);
}

ColladaProfileBRIDGEWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaProfileBRIDGEWriter, const string& url)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_PROFILE_BRIDGE);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_URL, url);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<profile_CG>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetID(ColladaProfileCGWriter)
COLLADA_DEFINE_OpenAsset(ColladaProfileCGWriter)
COLLADA_DEFINE_OpenExtra(ColladaProfileCGWriter)

void ColladaProfileCGWriter::SetPlatform(const string& value)
{
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_PLATFORM, value);
}

void ColladaProfileCGWriter::AddCode(const string& code, const string& sid)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_CODE);
	if (!sid.empty()) GetXmlWriter().AddAttribute(ColladaStrings::ATTR_SID, sid);
	GetXmlWriter().AddContentCData(code);
	GetXmlWriter().CloseElement();
}

void ColladaProfileCGWriter::AddInclude(const string& sid, const string& url)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_INCLUDE);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_SID, sid);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_URL, url);
	GetXmlWriter().CloseElement();
}

ColladaNewParamFXWriter ColladaProfileCGWriter::OpenNewParam(const string& sid)
{
	return ColladaNewParamFXWriter(GetFileWriter(), sid);
}

ColladaTechniqueFXWriter ColladaProfileCGWriter::OpenTechnique(const string& sid)
{
	return ColladaTechniqueFXWriter(GetFileWriter(), sid);
}

ColladaProfileCGWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaProfileCGWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_PROFILE_CG);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<profile_COMMON>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetID(ColladaProfileCOMMONWriter)
COLLADA_DEFINE_OpenAsset(ColladaProfileCOMMONWriter)
COLLADA_DEFINE_OpenExtra(ColladaProfileCOMMONWriter)

ColladaNewParamFXWriter ColladaProfileCOMMONWriter::OpenNewParam(const string& sid)
{
	return ColladaNewParamFXWriter(GetFileWriter(), sid);
}

ColladaTechniqueFXWriter ColladaProfileCOMMONWriter::OpenTechnique(const string& sid)
{
	return ColladaTechniqueFXWriter(GetFileWriter(), sid);
}

ColladaProfileCOMMONWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaProfileCOMMONWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_PROFILE_COMMON);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<profile_GLES>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetID(ColladaProfileGLESWriter)
COLLADA_DEFINE_OpenAsset(ColladaProfileGLESWriter)
COLLADA_DEFINE_OpenExtra(ColladaProfileGLESWriter)

void ColladaProfileGLESWriter::SetPlatform(const string& value)
{
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_PLATFORM, value);
}

ColladaNewParamFXWriter ColladaProfileGLESWriter::OpenNewParam(const string& sid)
{
	return ColladaNewParamFXWriter(GetFileWriter(), sid);
}

ColladaTechniqueFXWriter ColladaProfileGLESWriter::OpenTechnique(const string& sid)
{
	return ColladaTechniqueFXWriter(GetFileWriter(), sid);
}

ColladaProfileGLESWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaProfileGLESWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_PROFILE_GLES);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<profile_GLES2>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetID(ColladaProfileGLES2Writer)
COLLADA_DEFINE_OpenAsset(ColladaProfileGLES2Writer)
COLLADA_DEFINE_OpenExtra(ColladaProfileGLES2Writer)

void ColladaProfileGLES2Writer::SetPlatform(const string& value)
{
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_PLATFORM, value);
}

void ColladaProfileGLES2Writer::AddCode(const string& code, const string& sid)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_CODE);
	if (!sid.empty()) GetXmlWriter().AddAttribute(ColladaStrings::ATTR_SID, sid);
	GetXmlWriter().AddContentCData(code);
	GetXmlWriter().CloseElement();
}

void ColladaProfileGLES2Writer::AddInclude(const string& sid, const string& url)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_INCLUDE);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_SID, sid);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_URL, url);
	GetXmlWriter().CloseElement();
}

ColladaNewParamFXWriter ColladaProfileGLES2Writer::OpenNewParam(const string& sid)
{
	return ColladaNewParamFXWriter(GetFileWriter(), sid);
}

ColladaTechniqueFXWriter ColladaProfileGLES2Writer::OpenTechnique(const string& sid)
{
	return ColladaTechniqueFXWriter(GetFileWriter(), sid);
}

ColladaProfileGLES2Writer::COLLADA_ELEMENT_CTOR_IMPL(ColladaProfileGLES2Writer, const string& language)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_PROFILE_GLES2);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_LANGUAGE, language);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<profile_GLSL>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetID(ColladaProfileGLSLWriter)
COLLADA_DEFINE_OpenAsset(ColladaProfileGLSLWriter)
COLLADA_DEFINE_OpenExtra(ColladaProfileGLSLWriter)

void ColladaProfileGLSLWriter::SetPlatform(const string& value)
{
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_PLATFORM, value);
}

void ColladaProfileGLSLWriter::AddCode(const string& code, const string& sid)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_CODE);
	if (!sid.empty()) GetXmlWriter().AddAttribute(ColladaStrings::ATTR_SID, sid);
	GetXmlWriter().AddContentCData(code);
	GetXmlWriter().CloseElement();
}

void ColladaProfileGLSLWriter::AddInclude(const string& sid, const string& url)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_INCLUDE);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_SID, sid);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_URL, url);
	GetXmlWriter().CloseElement();
}

ColladaNewParamFXWriter ColladaProfileGLSLWriter::OpenNewParam(const string& sid)
{
	return ColladaNewParamFXWriter(GetFileWriter(), sid);
}

ColladaTechniqueFXWriter ColladaProfileGLSLWriter::OpenTechnique(const string& sid)
{
	return ColladaTechniqueFXWriter(GetFileWriter(), sid);
}

ColladaProfileGLSLWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaProfileGLSLWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_PROFILE_GLSL);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<program>
// -------------------------------------------------------------------------------------------------------------------------------------

void ColladaProgramWriter::AddBindAttribute(const string& symbol, const string& semantic)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_BIND_ATTRIBUTE);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_SYMBOL, symbol);
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_SEMANTIC);
	GetXmlWriter().AddContent(semantic);
	GetXmlWriter().CloseElement();
	GetXmlWriter().CloseElement();
}

ColladaShaderWriter ColladaProgramWriter::OpenShader(ColladaShaderStage::Type stage)
{
	return ColladaShaderWriter(GetFileWriter(), stage);
}

ColladaLinkerWriter ColladaProgramWriter::OpenLinker(const string& platform)
{
	return ColladaLinkerWriter(GetFileWriter(), platform);
}

ColladaBindUniformWriter ColladaProgramWriter::OpenBindUniform(const string& symbol)
{
	return ColladaBindUniformWriter(GetFileWriter(), symbol);
}

ColladaProgramWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaProgramWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_PROGRAM);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<render>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetName(ColladaRenderWriter)
COLLADA_DEFINE_SetSID(ColladaRenderWriter)
COLLADA_DEFINE_OpenExtra(ColladaRenderWriter)

void ColladaRenderWriter::SetCameraNode(const string& value)
{
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_CAMERA_NODE, value);
}

void ColladaRenderWriter::AddLayer(const string& layers)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_LAYER);
	GetXmlWriter().AddContent(layers);
	GetXmlWriter().CloseElement();
}

ColladaInstanceMaterialRenderingWriter ColladaRenderWriter::OpenInstanceMaterial(const string& url)
{
	return ColladaInstanceMaterialRenderingWriter(GetFileWriter(), url);
}

ColladaRenderWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaRenderWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_RENDER);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<RGB>
// -------------------------------------------------------------------------------------------------------------------------------------

void ColladaRGBWriter::SetOperator(ColladaTexCombinerOperator::Type value)
{
	switch (value)
	{
		case ColladaTexCombinerOperator::Replace:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_OPERATOR, ColladaStrings::ENUM_REPLACE);
			break;
		case ColladaTexCombinerOperator::Modulate:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_OPERATOR, ColladaStrings::ENUM_MODULATE);
			break;
		case ColladaTexCombinerOperator::Decal:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_OPERATOR, ColladaStrings::ENUM_DECAL);
			break;
		case ColladaTexCombinerOperator::Blend:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_OPERATOR, ColladaStrings::ENUM_BLEND);
			break;
		case ColladaTexCombinerOperator::Add:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_OPERATOR, ColladaStrings::ENUM_ADD);
			break;
		case ColladaTexCombinerOperator::AddSigned:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_OPERATOR, ColladaStrings::ENUM_ADD_SIGNED);
			break;
		case ColladaTexCombinerOperator::Interpolate:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_OPERATOR, ColladaStrings::ENUM_INTERPOLATE);
			break;
		case ColladaTexCombinerOperator::Subtract:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_OPERATOR, ColladaStrings::ENUM_SUBTRACT);
			break;
		case ColladaTexCombinerOperator::Dot3Rgb:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_OPERATOR, ColladaStrings::ENUM_DOT3_RGB);
			break;
		case ColladaTexCombinerOperator::Dot3Rgba:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_OPERATOR, ColladaStrings::ENUM_DOT3_RGBA);
			break;
	}
}

void ColladaRGBWriter::SetScale(float value)
{
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_SCALE, value);
}

void ColladaRGBWriter::AddArgument(ColladaTexCombinerSource::Type source, ColladaTexCombinerOperand::Type operand, const string& sampler)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_ARGUMENT);
	switch (source)
	{
		case ColladaTexCombinerSource::Texture:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_SOURCE, ColladaStrings::ENUM_TEXTURE);
			break;
		case ColladaTexCombinerSource::Constant:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_SOURCE, ColladaStrings::ENUM_CONSTANT);
			break;
		case ColladaTexCombinerSource::Primary:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_SOURCE, ColladaStrings::ENUM_PRIMARY);
			break;
		case ColladaTexCombinerSource::Previous:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_SOURCE, ColladaStrings::ENUM_PREVIOUS);
			break;
	}
	switch (operand)
	{
		case ColladaTexCombinerOperand::SrcColor:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_OPERAND, ColladaStrings::ENUM_SRC_COLOR);
			break;
		case ColladaTexCombinerOperand::OneMinusSrcColor:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_OPERAND, ColladaStrings::ENUM_ONE_MINUS_SRC_COLOR);
			break;
		case ColladaTexCombinerOperand::SrcAlpha:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_OPERAND, ColladaStrings::ENUM_SRC_ALPHA);
			break;
		case ColladaTexCombinerOperand::OneMinusSrcAlpha:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_OPERAND, ColladaStrings::ENUM_ONE_MINUS_SRC_ALPHA);
			break;
	}
	if (!sampler.empty()) GetXmlWriter().AddAttribute(ColladaStrings::ATTR_SAMPLER, sampler);
	GetXmlWriter().CloseElement();
}

ColladaRGBWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaRGBWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_RGB);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<shader>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_OpenExtra(ColladaShaderWriter)

ColladaSourcesWriter ColladaShaderWriter::OpenSources()
{
	return ColladaSourcesWriter(GetFileWriter());
}

ColladaCompilerWriter ColladaShaderWriter::OpenCompiler(const string& platform)
{
	return ColladaCompilerWriter(GetFileWriter(), platform);
}

ColladaBindUniformWriter ColladaShaderWriter::OpenBindUniform(const string& symbol)
{
	return ColladaBindUniformWriter(GetFileWriter(), symbol);
}

ColladaShaderWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaShaderWriter, ColladaShaderStage::Type stage)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_SHADER);
	switch (stage)
	{
		case ColladaShaderStage::Tesselation:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_STAGE, ColladaStrings::ENUM_TESSELATION);
			break;
		case ColladaShaderStage::Vertex:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_STAGE, ColladaStrings::ENUM_VERTEX);
			break;
		case ColladaShaderStage::Geometry:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_STAGE, ColladaStrings::ENUM_GEOMETRY);
			break;
		case ColladaShaderStage::Fragment:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_STAGE, ColladaStrings::ENUM_FRAGMENT);
			break;
	}
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<sources>
// -------------------------------------------------------------------------------------------------------------------------------------

void ColladaSourcesWriter::SetEntry(const string& value)
{
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_ENTRY, value);
}

void ColladaSourcesWriter::AddInline(const string& value)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_INLINE);
	GetXmlWriter().AddContent(value);
	GetXmlWriter().CloseElement();
}

void ColladaSourcesWriter::AddImport(const string& ref)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_IMPORT);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_REF, ref);
	GetXmlWriter().CloseElement();
}

ColladaSourcesWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaSourcesWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_SOURCES);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<states>
// -------------------------------------------------------------------------------------------------------------------------------------

void ColladaStatesWriter::AddValue(const string& stateName, const string& value, const string& index)
{
	GetXmlWriter().OpenElement(stateName);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_VALUE, value);
	if (!index.empty()) GetXmlWriter().AddAttribute(ColladaStrings::ATTR_INDEX, index);
	GetXmlWriter().CloseElement();
}

void ColladaStatesWriter::AddValue(const string& stateName, const string& value, int index)
{
	GetXmlWriter().OpenElement(stateName);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_VALUE, value);
	if (index >= 0) GetXmlWriter().AddAttribute(ColladaStrings::ATTR_INDEX, index);
	GetXmlWriter().CloseElement();
}

void ColladaStatesWriter::AddParam(const string& stateName, const string& param, const string& index)
{
	GetXmlWriter().OpenElement(stateName);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_PARAM, param);
	if (!index.empty()) GetXmlWriter().AddAttribute(ColladaStrings::ATTR_INDEX, index);
	GetXmlWriter().CloseElement();
}

void ColladaStatesWriter::AddParam(const string& stateName, const string& param, int index)
{
	GetXmlWriter().OpenElement(stateName);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_PARAM, param);
	if (index >= 0) GetXmlWriter().AddAttribute(ColladaStrings::ATTR_INDEX, index);
	GetXmlWriter().CloseElement();
}

ColladaTexturePipelineWriter ColladaStatesWriter::OpenTexturePipeline()
{
	return ColladaTexturePipelineWriter(GetFileWriter());
}

ColladaStatesWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaStatesWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_STATES);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<stencil_target>
// -------------------------------------------------------------------------------------------------------------------------------------

void ColladaStencilTargetWriter::SetIndex(unsigned int value)
{
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_INDEX, value);
}

void ColladaStencilTargetWriter::SetSlice(unsigned int value)
{
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_SLICE, value);
}

void ColladaStencilTargetWriter::SetMip(unsigned int value)
{
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_MIP, value);
}

void ColladaStencilTargetWriter::SetFace(ColladaCubeFace::Type value)
{
	switch (value)
	{
		case ColladaCubeFace::PositiveX:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_FACE, ColladaStrings::ENUM_POSITIVE_X);
			break;
		case ColladaCubeFace::NegativeX:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_FACE, ColladaStrings::ENUM_NEGATIVE_X);
			break;
		case ColladaCubeFace::PositiveY:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_FACE, ColladaStrings::ENUM_POSITIVE_Y);
			break;
		case ColladaCubeFace::NegativeY:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_FACE, ColladaStrings::ENUM_NEGATIVE_Y);
			break;
		case ColladaCubeFace::PositiveZ:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_FACE, ColladaStrings::ENUM_POSITIVE_Z);
			break;
		case ColladaCubeFace::NegativeZ:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_FACE, ColladaStrings::ENUM_NEGATIVE_Z);
			break;
	}
}

void ColladaStencilTargetWriter::AddParam(const string& ref)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_PARAM);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_REF, ref);
	GetXmlWriter().CloseElement();
}

ColladaInstanceImageWriter ColladaStencilTargetWriter::OpenInstanceImage(const string& url)
{
	return ColladaInstanceImageWriter::CreateInstanceImage(GetFileWriter(), url);
}

ColladaStencilTargetWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaStencilTargetWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_STENCIL_TARGET);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<technique> (FX)
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetID(ColladaTechniqueFXWriter)
COLLADA_DEFINE_OpenAsset(ColladaTechniqueFXWriter)
COLLADA_DEFINE_OpenExtra(ColladaTechniqueFXWriter)

ColladaAnnotateWriter ColladaTechniqueFXWriter::OpenAnnotate(const string& name)
{
	return ColladaAnnotateWriter(GetFileWriter(), name);
}

ColladaBlinnWriter ColladaTechniqueFXWriter::OpenBlinn()
{
	return ColladaBlinnWriter(GetFileWriter());
}

ColladaConstantFXWriter ColladaTechniqueFXWriter::OpenConstant()
{
	return ColladaConstantFXWriter(GetFileWriter());
}

ColladaLambertWriter ColladaTechniqueFXWriter::OpenLambert()
{
	return ColladaLambertWriter(GetFileWriter());
}

ColladaPhongWriter ColladaTechniqueFXWriter::OpenPhong()
{
	return ColladaPhongWriter(GetFileWriter());
}

ColladaPassWriter ColladaTechniqueFXWriter::OpenPass()
{
	return ColladaPassWriter(GetFileWriter());
}

ColladaTechniqueFXWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaTechniqueFXWriter, const string& sid)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_TECHNIQUE);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_SID, sid);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<texcombiner>
// -------------------------------------------------------------------------------------------------------------------------------------

void ColladaTexCombinerWriter::AddConstant(double x, double y, double z, double w)
{
	char Buffer[512];
	sprintf_s(Buffer, "%g %g %g %g", x, y, z, w);
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_CONSTANT);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_VALUE, string(Buffer));
	GetXmlWriter().CloseElement();
}

void ColladaTexCombinerWriter::AddConstant(const string& param)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_CONSTANT);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_PARAM, param);
	GetXmlWriter().CloseElement();
}

ColladaRGBWriter ColladaTexCombinerWriter::OpenRGB()
{
	return ColladaRGBWriter(GetFileWriter());
}

ColladaAlphaWriter ColladaTexCombinerWriter::OpenAlpha()
{
	return ColladaAlphaWriter(GetFileWriter());
}

ColladaTexCombinerWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaTexCombinerWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_TEXCOMBINER);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<texenv>
// -------------------------------------------------------------------------------------------------------------------------------------

void ColladaTexEnvWriter::SetOperator(ColladaTexCombinerOperator::Type value)
{
	switch (value)
	{
		case ColladaTexCombinerOperator::Replace:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_OPERATOR, ColladaStrings::ENUM_REPLACE);
			break;
		case ColladaTexCombinerOperator::Modulate:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_OPERATOR, ColladaStrings::ENUM_MODULATE);
			break;
		case ColladaTexCombinerOperator::Decal:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_OPERATOR, ColladaStrings::ENUM_DECAL);
			break;
		case ColladaTexCombinerOperator::Blend:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_OPERATOR, ColladaStrings::ENUM_BLEND);
			break;
		case ColladaTexCombinerOperator::Add:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_OPERATOR, ColladaStrings::ENUM_ADD);
			break;
		case ColladaTexCombinerOperator::AddSigned:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_OPERATOR, ColladaStrings::ENUM_ADD_SIGNED);
			break;
		case ColladaTexCombinerOperator::Interpolate:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_OPERATOR, ColladaStrings::ENUM_INTERPOLATE);
			break;
		case ColladaTexCombinerOperator::Subtract:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_OPERATOR, ColladaStrings::ENUM_SUBTRACT);
			break;
		case ColladaTexCombinerOperator::Dot3Rgb:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_OPERATOR, ColladaStrings::ENUM_DOT3_RGB);
			break;
		case ColladaTexCombinerOperator::Dot3Rgba:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_OPERATOR, ColladaStrings::ENUM_DOT3_RGBA);
			break;
	}
}

void ColladaTexEnvWriter::SetSampler(const string& value)
{
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_SAMPLER, value);
}

void ColladaTexEnvWriter::AddConstant(double x, double y, double z, double w)
{
	char Buffer[512];
	sprintf_s(Buffer, "%g %g %g %g", x, y, z, w);
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_CONSTANT);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_VALUE, string(Buffer));
	GetXmlWriter().CloseElement();
}

void ColladaTexEnvWriter::AddConstant(const string& param)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_CONSTANT);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_PARAM, param);
	GetXmlWriter().CloseElement();
}

ColladaTexEnvWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaTexEnvWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_TEXENV);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<texture_pipeline>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_OpenExtra(ColladaTexturePipelineWriter)

ColladaTexCombinerWriter ColladaTexturePipelineWriter::OpenTexCombiner()
{
	return ColladaTexCombinerWriter(GetFileWriter());
}

ColladaTexEnvWriter ColladaTexturePipelineWriter::OpenTexEnv()
{
	return ColladaTexEnvWriter(GetFileWriter());
}

ColladaTexturePipelineWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaTexturePipelineWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_TEXTURE_PIPELINE);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<brep>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_OpenExtra(ColladaBRepWriter)

ColladaCurvesWriter ColladaBRepWriter::OpenCurves()
{
	return ColladaCurvesWriter(GetFileWriter());
}

ColladaSurfaceCurvesWriter ColladaBRepWriter::OpenSurfaceCurves()
{
	return ColladaSurfaceCurvesWriter(GetFileWriter());
}

ColladaSurfacesWriter ColladaBRepWriter::OpenSurfaces()
{
	return ColladaSurfacesWriter(GetFileWriter());
}

ColladaSourceCoreWriter ColladaBRepWriter::OpenSource(const string& id)
{
	return ColladaSourceCoreWriter(GetFileWriter(), id);
}

ColladaVerticesWriter ColladaBRepWriter::OpenVertices(const string& id)
{
	return ColladaVerticesWriter(GetFileWriter(), id);
}

ColladaEdgesWriter ColladaBRepWriter::OpenEdges()
{
	return ColladaEdgesWriter(GetFileWriter());
}

ColladaWiresWriter ColladaBRepWriter::OpenWires(const string& id, unsigned int count)
{
	return ColladaWiresWriter(GetFileWriter(), id, count);
}

ColladaFacesWriter ColladaBRepWriter::OpenFaces()
{
	return ColladaFacesWriter(GetFileWriter());
}

ColladaPCurvesWriter ColladaBRepWriter::OpenPCurves(const string& id, unsigned int count)
{
	return ColladaPCurvesWriter(GetFileWriter(), id, count);
}

ColladaShellsWriter ColladaBRepWriter::OpenShells(const string& id, unsigned int count)
{
	return ColladaShellsWriter(GetFileWriter(), id, count);
}

ColladaSolidsWriter ColladaBRepWriter::OpenSolids(const string& id, unsigned int count)
{
	return ColladaSolidsWriter(GetFileWriter(), id, count);
}

ColladaBRepWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaBRepWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_BREP);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<circle>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_OpenExtra(ColladaCircleWriter)

void ColladaCircleWriter::AddRadius(double value)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_RADIUS);
	GetXmlWriter().AddContent(value);
	GetXmlWriter().CloseElement();
}

ColladaCircleWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaCircleWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_CIRCLE);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<cone>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_OpenExtra(ColladaConeWriter)

void ColladaConeWriter::AddRadius(double value)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_RADIUS);
	GetXmlWriter().AddContent(value);
	GetXmlWriter().CloseElement();
}

void ColladaConeWriter::AddAngle(double value)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_ANGLE);
	GetXmlWriter().AddContent(value);
	GetXmlWriter().CloseElement();
}

ColladaConeWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaConeWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_CONE);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<curve>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetSID(ColladaCurveWriter)
COLLADA_DEFINE_SetName(ColladaCurveWriter)

void ColladaCurveWriter::AddOrient(double axisX, double axisY, double axisZ, double angle)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_ORIENT);
	GetXmlWriter().AddContent(axisX);
	GetXmlWriter().AddContent(axisY);
	GetXmlWriter().AddContent(axisZ);
	GetXmlWriter().AddContent(angle);
	GetXmlWriter().CloseElement();
}

void ColladaCurveWriter::AddOrigin(double x, double y, double z)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_ORIGIN);
	GetXmlWriter().AddContent(x);
	GetXmlWriter().AddContent(y);
	GetXmlWriter().AddContent(z);
	GetXmlWriter().CloseElement();
}

ColladaLineWriter ColladaCurveWriter::OpenLine()
{
	return ColladaLineWriter(GetFileWriter());
}

ColladaCircleWriter ColladaCurveWriter::OpenCircle()
{
	return ColladaCircleWriter(GetFileWriter());
}

ColladaEllipseWriter ColladaCurveWriter::OpenEllipse()
{
	return ColladaEllipseWriter(GetFileWriter());
}

ColladaParabolaWriter ColladaCurveWriter::OpenParabola()
{
	return ColladaParabolaWriter(GetFileWriter());
}

ColladaHyperbolaWriter ColladaCurveWriter::OpenHyperbola()
{
	return ColladaHyperbolaWriter(GetFileWriter());
}

ColladaNurbsWriter ColladaCurveWriter::OpenNurbs(unsigned int degree)
{
	return ColladaNurbsWriter(GetFileWriter(), degree);
}

ColladaCurveWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaCurveWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_CURVE);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<curves>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_OpenExtra(ColladaCurvesWriter)

ColladaCurveWriter ColladaCurvesWriter::OpenCurve()
{
	return ColladaCurveWriter(GetFileWriter());
}

ColladaCurvesWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaCurvesWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_CURVES);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<cylinder> (B-Rep)
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_OpenExtra(ColladaCylinderBRepWriter)

void ColladaCylinderBRepWriter::AddRadius(double x, double y)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_RADIUS);
	GetXmlWriter().AddContent(x);
	GetXmlWriter().AddContent(y);
	GetXmlWriter().CloseElement();
}

ColladaCylinderBRepWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaCylinderBRepWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_CYLINDER);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<edges>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_AddInputShared(ColladaEdgesWriter)
COLLADA_DEFINE_OpenExtra(ColladaEdgesWriter)
COLLADA_DEFINE_Indices(ColladaEdgesWriter)

ColladaEdgesWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaEdgesWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_EDGES);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<ellipse>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_OpenExtra(ColladaEllipseWriter)

void ColladaEllipseWriter::AddRadius(double x, double y)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_RADIUS);
	GetXmlWriter().AddContent(x);
	GetXmlWriter().AddContent(y);
	GetXmlWriter().CloseElement();
}

ColladaEllipseWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaEllipseWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_ELLIPSE);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<faces>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_AddInputShared(ColladaFacesWriter)
COLLADA_DEFINE_OpenExtra(ColladaFacesWriter)
COLLADA_DEFINE_VCount(ColladaFacesWriter)
COLLADA_DEFINE_Indices(ColladaFacesWriter)

ColladaFacesWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaFacesWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_FACES);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<hyperbola>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_OpenExtra(ColladaHyperbolaWriter)

void ColladaHyperbolaWriter::AddRadius(double x, double y)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_RADIUS);
	GetXmlWriter().AddContent(x);
	GetXmlWriter().AddContent(y);
	GetXmlWriter().CloseElement();
}

ColladaHyperbolaWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaHyperbolaWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_HYPERBOLA);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<line>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_OpenExtra(ColladaLineWriter)

void ColladaLineWriter::AddOrigin(double x, double y, double z)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_ORIGIN);
	GetXmlWriter().AddContent(x);
	GetXmlWriter().AddContent(y);
	GetXmlWriter().AddContent(z);
	GetXmlWriter().CloseElement();
}

void ColladaLineWriter::AddDirection(double x, double y, double z)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_DIRECTION);
	GetXmlWriter().AddContent(x);
	GetXmlWriter().AddContent(y);
	GetXmlWriter().AddContent(z);
	GetXmlWriter().CloseElement();
}

ColladaLineWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaLineWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_LINE);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<nurbs>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_OpenExtra(ColladaNurbsWriter)

void ColladaNurbsWriter::SetClosed(bool value)
{
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_CLOSED, value);
}

ColladaSourceCoreWriter ColladaNurbsWriter::OpenSource(const string& id)
{
	return ColladaSourceCoreWriter(GetFileWriter(), id);
}

ColladaControlVerticesWriter ColladaNurbsWriter::OpenControlVertices()
{
	return ColladaControlVerticesWriter(GetFileWriter());
}

ColladaNurbsWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaNurbsWriter, unsigned int degree)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_NURBS);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_DEGREE, degree);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<nurbs_surface>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_OpenExtra(ColladaNurbsSurfaceWriter)

void ColladaNurbsSurfaceWriter::SetClosedU(bool value)
{
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_CLOSED_U, value);
}

void ColladaNurbsSurfaceWriter::SetClosedV(bool value)
{
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_CLOSED_V, value);
}

ColladaSourceCoreWriter ColladaNurbsSurfaceWriter::OpenSource(const string& id)
{
	return ColladaSourceCoreWriter(GetFileWriter(), id);
}

ColladaControlVerticesWriter ColladaNurbsSurfaceWriter::OpenControlVertices()
{
	return ColladaControlVerticesWriter(GetFileWriter());
}

ColladaNurbsSurfaceWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaNurbsSurfaceWriter, unsigned int degreeU, unsigned int degreeV)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_NURBS_SURFACE);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_DEGREE_U, degreeU);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_DEGREE_V, degreeV);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<parabola>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_OpenExtra(ColladaParabolaWriter)

void ColladaParabolaWriter::AddFocal(double value)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_FOCAL);
	GetXmlWriter().AddContent(value);
	GetXmlWriter().CloseElement();
}

ColladaParabolaWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaParabolaWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_PARABOLA);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<pcurves>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetName(ColladaPCurvesWriter)
COLLADA_DEFINE_AddInputShared(ColladaPCurvesWriter)
COLLADA_DEFINE_OpenExtra(ColladaPCurvesWriter)
COLLADA_DEFINE_VCount(ColladaPCurvesWriter)
COLLADA_DEFINE_Indices(ColladaPCurvesWriter)

ColladaPCurvesWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaPCurvesWriter, const string& id, unsigned int count)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_PCURVES);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_ID, id);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_COUNT, count);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<shells>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetName(ColladaShellsWriter)
COLLADA_DEFINE_AddInputShared(ColladaShellsWriter)
COLLADA_DEFINE_OpenExtra(ColladaShellsWriter)
COLLADA_DEFINE_VCount(ColladaShellsWriter)
COLLADA_DEFINE_Indices(ColladaShellsWriter)

ColladaShellsWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaShellsWriter, const string& id, unsigned int count)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_SHELLS);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_ID, id);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_COUNT, count);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<solids>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetName(ColladaSolidsWriter)
COLLADA_DEFINE_AddInputShared(ColladaSolidsWriter)
COLLADA_DEFINE_OpenExtra(ColladaSolidsWriter)
COLLADA_DEFINE_VCount(ColladaSolidsWriter)
COLLADA_DEFINE_Indices(ColladaSolidsWriter)

ColladaSolidsWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaSolidsWriter, const string& id, unsigned int count)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_SOLIDS);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_ID, id);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_COUNT, count);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<surface>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetSID(ColladaSurfaceWriter)
COLLADA_DEFINE_SetName(ColladaSurfaceWriter)

void ColladaSurfaceWriter::AddOrient(double axisX, double axisY, double axisZ, double angle)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_ORIENT);
	GetXmlWriter().AddContent(axisX);
	GetXmlWriter().AddContent(axisY);
	GetXmlWriter().AddContent(axisZ);
	GetXmlWriter().AddContent(angle);
	GetXmlWriter().CloseElement();
}

void ColladaSurfaceWriter::AddOrigin(double x, double y, double z)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_ORIGIN);
	GetXmlWriter().AddContent(x);
	GetXmlWriter().AddContent(y);
	GetXmlWriter().AddContent(z);
	GetXmlWriter().CloseElement();
}

ColladaConeWriter ColladaSurfaceWriter::OpenCone()
{
	return ColladaConeWriter(GetFileWriter());
}

ColladaPlaneWriter ColladaSurfaceWriter::OpenPlane()
{
	return ColladaPlaneWriter(GetFileWriter());
}

ColladaCylinderBRepWriter ColladaSurfaceWriter::OpenCylinder()
{
	return ColladaCylinderBRepWriter(GetFileWriter());
}

ColladaNurbsSurfaceWriter ColladaSurfaceWriter::OpenNurbsSurface(unsigned int degreeU, unsigned int degreeV)
{
	return ColladaNurbsSurfaceWriter(GetFileWriter(), degreeU, degreeV);
}

ColladaSphereWriter ColladaSurfaceWriter::OpenSphere()
{
	return ColladaSphereWriter(GetFileWriter());
}

ColladaTorusWriter ColladaSurfaceWriter::OpenTorus()
{
	return ColladaTorusWriter(GetFileWriter());
}

ColladaSweptSurfaceWriter ColladaSurfaceWriter::OpenSweptSurface()
{
	return ColladaSweptSurfaceWriter(GetFileWriter());
}

ColladaSurfaceWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaSurfaceWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_SURFACE);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<surfaces>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_OpenExtra(ColladaSurfacesWriter)

ColladaSurfaceWriter ColladaSurfacesWriter::OpenSurface()
{
	return ColladaSurfaceWriter(GetFileWriter());
}

ColladaSurfacesWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaSurfacesWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_SURFACES);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<surface_curves>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_OpenExtra(ColladaSurfaceCurvesWriter)

ColladaCurveWriter ColladaSurfaceCurvesWriter::OpenCurve()
{
	return ColladaCurveWriter(GetFileWriter());
}

ColladaSurfaceCurvesWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaSurfaceCurvesWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_SURFACE_CURVES);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<swept_surface>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_OpenExtra(ColladaSweptSurfaceWriter)

void ColladaSweptSurfaceWriter::AddDirection(double x, double y, double z)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_DIRECTION);
	GetXmlWriter().AddContent(x);
	GetXmlWriter().AddContent(y);
	GetXmlWriter().AddContent(z);
	GetXmlWriter().CloseElement();
}

void ColladaSweptSurfaceWriter::AddOrigin(double x, double y, double z)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_ORIGIN);
	GetXmlWriter().AddContent(x);
	GetXmlWriter().AddContent(y);
	GetXmlWriter().AddContent(z);
	GetXmlWriter().CloseElement();
}

void ColladaSweptSurfaceWriter::AddAxis(double x, double y, double z)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_AXIS);
	GetXmlWriter().AddContent(x);
	GetXmlWriter().AddContent(y);
	GetXmlWriter().AddContent(z);
	GetXmlWriter().CloseElement();
}

ColladaCurveWriter ColladaSweptSurfaceWriter::OpenCurve()
{
	return ColladaCurveWriter(GetFileWriter());
}

ColladaSweptSurfaceWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaSweptSurfaceWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_SWEPT_SURFACE);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<torus>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_OpenExtra(ColladaTorusWriter)

void ColladaTorusWriter::AddRadius(double x, double y)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_RADIUS);
	GetXmlWriter().AddContent(x);
	GetXmlWriter().AddContent(y);
	GetXmlWriter().CloseElement();
}

ColladaTorusWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaTorusWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_TORUS);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<wires>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetName(ColladaWiresWriter)
COLLADA_DEFINE_AddInputShared(ColladaWiresWriter)
COLLADA_DEFINE_OpenExtra(ColladaWiresWriter)
COLLADA_DEFINE_VCount(ColladaWiresWriter)
COLLADA_DEFINE_Indices(ColladaWiresWriter)

ColladaWiresWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaWiresWriter, const string& id, unsigned int count)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_WIRES);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_ID, id);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_COUNT, count);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<articulated_system>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_OpenAsset(ColladaArticulatedSystemWriter)
COLLADA_DEFINE_OpenExtra(ColladaArticulatedSystemWriter)

ColladaKinematicsWriter ColladaArticulatedSystemWriter::OpenKinematics()
{
	return ColladaKinematicsWriter(GetFileWriter());
}

ColladaMotionWriter ColladaArticulatedSystemWriter::OpenMotion()
{
	return ColladaMotionWriter(GetFileWriter());
}

ColladaArticulatedSystemWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaArticulatedSystemWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_ARTICULATED_SYSTEM);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<attachment_end>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_AddTranslate(ColladaAttachmentEndWriter)
COLLADA_DEFINE_AddRotate(ColladaAttachmentEndWriter)

ColladaAttachmentEndWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaAttachmentEndWriter, const string& joint)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_ATTACHMENT_END);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_JOINT, joint);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<attachment_full>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_AddRotate(ColladaAttachmentFullWriter)
COLLADA_DEFINE_AddTranslate(ColladaAttachmentFullWriter)

ColladaLinkWriter ColladaAttachmentFullWriter::OpenLink()
{
	return ColladaLinkWriter(GetFileWriter());
}

ColladaAttachmentFullWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaAttachmentFullWriter, const string& joint)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_ATTACHMENT_FULL);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_JOINT, joint);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<attachment_start>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_AddTranslate(ColladaAttachmentStartWriter)
COLLADA_DEFINE_AddRotate(ColladaAttachmentStartWriter)

ColladaAttachmentStartWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaAttachmentStartWriter, const string& joint)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_ATTACHMENT_START);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_JOINT, joint);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<axis_info>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetSID(ColladaAxisInfoWriter)
COLLADA_DEFINE_SetName(ColladaAxisInfoWriter)

ColladaAxisInfoWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaAxisInfoWriter, const string& axis)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_AXIS_INFO);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_AXIS, axis);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<bind_joint_axis>
// -------------------------------------------------------------------------------------------------------------------------------------

void ColladaBindJointAxisWriter::SetTarget(const string& value)
{
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_TARGET, value);
}

ColladaBindJointAxisWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaBindJointAxisWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_BIND_JOINT_AXIS);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<bind_kinematics_model>
// -------------------------------------------------------------------------------------------------------------------------------------

ColladaBindKinematicsModelWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaBindKinematicsModelWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_BIND_KINEMATICS_MODEL);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<effector_info>
// -------------------------------------------------------------------------------------------------------------------------------------

ColladaEffectorInfoWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaEffectorInfoWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_EFFECTOR_INFO);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<frame_*>
// -------------------------------------------------------------------------------------------------------------------------------------

// -------------------------------------------------------------------------------------------------------------------------------------
//		<instance_articulated_system>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetSID(ColladaInstanceArticulatedSystemWriter)
COLLADA_DEFINE_SetName(ColladaInstanceArticulatedSystemWriter)
COLLADA_DEFINE_OpenExtra(ColladaInstanceArticulatedSystemWriter)
COLLADA_DEFINE_AddBindKinematics(ColladaInstanceArticulatedSystemWriter)

ColladaInstanceArticulatedSystemWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaInstanceArticulatedSystemWriter, const string& url)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_INSTANCE_ARTICULATED_SYSTEM);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_URL, url);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<instance_joint>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetSID(ColladaInstanceJointWriter)
COLLADA_DEFINE_SetName(ColladaInstanceJointWriter)
COLLADA_DEFINE_OpenExtra(ColladaInstanceJointWriter)

ColladaInstanceJointWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaInstanceJointWriter, const string& url)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_INSTANCE_JOINT);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_URL, url);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<instance_kinematics_model>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetSID(ColladaInstanceKinematicsModelWriter)
COLLADA_DEFINE_SetName(ColladaInstanceKinematicsModelWriter)
COLLADA_DEFINE_OpenExtra(ColladaInstanceKinematicsModelWriter)

ColladaInstanceKinematicsModelWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaInstanceKinematicsModelWriter, const string& url)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_INSTANCE_KINEMATICS_MODEL);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_URL, url);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<instance_kinematics_scene>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetSID(ColladaInstanceKinematicsSceneWriter)
COLLADA_DEFINE_SetName(ColladaInstanceKinematicsSceneWriter)
COLLADA_DEFINE_OpenExtra(ColladaInstanceKinematicsSceneWriter)

ColladaInstanceKinematicsSceneWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaInstanceKinematicsSceneWriter, const string& url)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_INSTANCE_KINEMATICS_SCENE);
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_URL, url);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<joint>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetID(ColladaJointWriter)
COLLADA_DEFINE_SetSID(ColladaJointWriter)
COLLADA_DEFINE_SetName(ColladaJointWriter)
COLLADA_DEFINE_OpenExtra(ColladaJointWriter)

ColladaPrismaticWriter ColladaJointWriter::OpenPrismatic()
{
	return ColladaPrismaticWriter(GetFileWriter());
}

ColladaRevoluteWriter ColladaJointWriter::OpenRevolute()
{
	return ColladaRevoluteWriter(GetFileWriter());
}

ColladaJointWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaJointWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_JOINT);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<kinematics>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_OpenExtra(ColladaKinematicsWriter)

ColladaKinematicsWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaKinematicsWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_KINEMATICS);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<kinematics_model>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_OpenExtra(ColladaKinematicsModelWriter)

ColladaKinematicsModelWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaKinematicsModelWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_KINEMATICS_MODEL);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<kinematics_scene>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_OpenExtra(ColladaKinematicsSceneWriter)

ColladaKinematicsSceneWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaKinematicsSceneWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_KINEMATICS_SCENE);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<library_articulated_systems>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetID(ColladaLibraryArticulatedSystemsWriter)
COLLADA_DEFINE_SetName(ColladaLibraryArticulatedSystemsWriter)
COLLADA_DEFINE_OpenAsset(ColladaLibraryArticulatedSystemsWriter)
COLLADA_DEFINE_OpenExtra(ColladaLibraryArticulatedSystemsWriter)

ColladaArticulatedSystemWriter ColladaLibraryArticulatedSystemsWriter::OpenArticulatedSystem()
{
	return ColladaArticulatedSystemWriter(GetFileWriter());
}

ColladaLibraryArticulatedSystemsWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaLibraryArticulatedSystemsWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_LIBRARY_ARTICUALED_SYSTEMS);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<library_joints>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetID(ColladaLibraryJointsWriter)
COLLADA_DEFINE_SetName(ColladaLibraryJointsWriter)
COLLADA_DEFINE_OpenAsset(ColladaLibraryJointsWriter)
COLLADA_DEFINE_OpenExtra(ColladaLibraryJointsWriter)

ColladaJointWriter ColladaLibraryJointsWriter::OpenJoint()
{
	return ColladaJointWriter(GetFileWriter());
}

ColladaLibraryJointsWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaLibraryJointsWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_LIBRARY_JOINTS);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<library_kinematics_models>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetID(ColladaLibraryKinematicsModelsWriter)
COLLADA_DEFINE_SetName(ColladaLibraryKinematicsModelsWriter)
COLLADA_DEFINE_OpenAsset(ColladaLibraryKinematicsModelsWriter)
COLLADA_DEFINE_OpenExtra(ColladaLibraryKinematicsModelsWriter)

ColladaKinematicsModelWriter ColladaLibraryKinematicsModelsWriter::OpenKinematicsModel()
{
	return ColladaKinematicsModelWriter(GetFileWriter());
}

ColladaLibraryKinematicsModelsWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaLibraryKinematicsModelsWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_LIBRARY_KINEMATICS_MODELS);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<library_kinematics_scenes>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetID(ColladaLibraryKinematicsScenesWriter)
COLLADA_DEFINE_SetName(ColladaLibraryKinematicsScenesWriter)
COLLADA_DEFINE_OpenAsset(ColladaLibraryKinematicsScenesWriter)
COLLADA_DEFINE_OpenExtra(ColladaLibraryKinematicsScenesWriter)

ColladaKinematicsSceneWriter ColladaLibraryKinematicsScenesWriter::OpenKinematicsScene()
{
	return ColladaKinematicsSceneWriter(GetFileWriter());
}

ColladaLibraryKinematicsScenesWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaLibraryKinematicsScenesWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_LIBRARY_KINEMATICS_SCENES);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<link>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_SetSID(ColladaLinkWriter)
COLLADA_DEFINE_SetName(ColladaLinkWriter)
COLLADA_DEFINE_AddRotate(ColladaLinkWriter)
COLLADA_DEFINE_AddTranslate(ColladaLinkWriter)

ColladaAttachmentFullWriter ColladaLinkWriter::OpenAttachmentFull(const string& joint)
{
	return ColladaAttachmentFullWriter(GetFileWriter(), joint);
}

ColladaAttachmentStartWriter ColladaLinkWriter::OpenAttachmentStart(const string& joint)
{
	return ColladaAttachmentStartWriter(GetFileWriter(), joint);
}

ColladaAttachmentEndWriter ColladaLinkWriter::OpenAttachmentEnd(const string& joint)
{
	return ColladaAttachmentEndWriter(GetFileWriter(), joint);
}

ColladaLinkWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaLinkWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_LINK);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<motion>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_OpenExtra(ColladaMotionWriter)

ColladaMotionWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaMotionWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_MOTION);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<prismatic>
// -------------------------------------------------------------------------------------------------------------------------------------

ColladaPrismaticWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaPrismaticWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_PRISMATIC);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<revolute>
// -------------------------------------------------------------------------------------------------------------------------------------

ColladaRevoluteWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaRevoluteWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_REVOLUTE);
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		<COLLADA>
// -------------------------------------------------------------------------------------------------------------------------------------

COLLADA_DEFINE_OpenAsset(ColladaCOLLADAWriter)
COLLADA_DEFINE_OpenExtra(ColladaCOLLADAWriter)

void ColladaCOLLADAWriter::SetXmlNamespace(const string& value)
{
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_XMLNS, value);
}

void ColladaCOLLADAWriter::SetBase(const string& value)
{
	GetXmlWriter().AddAttribute(ColladaStrings::ATTR_BASE, value);
}

ColladaLibraryAnimationClipsWriter ColladaCOLLADAWriter::OpenLibraryAnimationClips()
{
	return ColladaLibraryAnimationClipsWriter(GetFileWriter());
}

ColladaLibraryAnimationsWriter ColladaCOLLADAWriter::OpenLibraryAnimations()
{
	return ColladaLibraryAnimationsWriter(GetFileWriter());
}

ColladaLibraryArticulatedSystemsWriter ColladaCOLLADAWriter::OpenLibraryArticulatedSystems()
{
	return ColladaLibraryArticulatedSystemsWriter(GetFileWriter());
}

ColladaLibraryCamerasWriter ColladaCOLLADAWriter::OpenLibraryCameras()
{
	return ColladaLibraryCamerasWriter(GetFileWriter());
}

ColladaLibraryControllersWriter ColladaCOLLADAWriter::OpenLibraryControllers()
{
	return ColladaLibraryControllersWriter(GetFileWriter());
}

ColladaLibraryEffectsWriter ColladaCOLLADAWriter::OpenLibraryEffects()
{
	return ColladaLibraryEffectsWriter(GetFileWriter());
}

ColladaLibraryForceFieldsWriter ColladaCOLLADAWriter::OpenLibraryForceFields()
{
	return ColladaLibraryForceFieldsWriter(GetFileWriter());
}

ColladaLibraryFormulasWriter ColladaCOLLADAWriter::OpenLibraryFormulas()
{
	return ColladaLibraryFormulasWriter(GetFileWriter());
}

ColladaLibraryGeometriesWriter ColladaCOLLADAWriter::OpenLibraryGeometries()
{
	return ColladaLibraryGeometriesWriter(GetFileWriter());
}

ColladaLibraryImagesWriter ColladaCOLLADAWriter::OpenLibraryImages()
{
	return ColladaLibraryImagesWriter(GetFileWriter());
}

ColladaLibraryJointsWriter ColladaCOLLADAWriter::OpenLibraryJoints()
{
	return ColladaLibraryJointsWriter(GetFileWriter());
}

ColladaLibraryKinematicsModelsWriter ColladaCOLLADAWriter::OpenLibraryKinematicsModels()
{
	return ColladaLibraryKinematicsModelsWriter(GetFileWriter());
}

ColladaLibraryKinematicsScenesWriter ColladaCOLLADAWriter::OpenLibraryKinematicsScenes()
{
	return ColladaLibraryKinematicsScenesWriter(GetFileWriter());
}

ColladaLibraryLightsWriter ColladaCOLLADAWriter::OpenLibraryLights()
{
	return ColladaLibraryLightsWriter(GetFileWriter());
}

ColladaLibraryMaterialsWriter ColladaCOLLADAWriter::OpenLibraryMaterials()
{
	return ColladaLibraryMaterialsWriter(GetFileWriter());
}

ColladaLibraryNodesWriter ColladaCOLLADAWriter::OpenLibraryNodes()
{
	return ColladaLibraryNodesWriter(GetFileWriter());
}

ColladaLibraryPhysicsMaterialsWriter ColladaCOLLADAWriter::OpenLibraryPhysicsMaterials()
{
	return ColladaLibraryPhysicsMaterialsWriter(GetFileWriter());
}

ColladaLibraryPhysicsModelsWriter ColladaCOLLADAWriter::OpenLibraryPhysicsModels()
{
	return ColladaLibraryPhysicsModelsWriter(GetFileWriter());
}

ColladaLibraryPhysicsScenesWriter ColladaCOLLADAWriter::OpenLibraryPhysicsScenes()
{
	return ColladaLibraryPhysicsScenesWriter(GetFileWriter());
}

ColladaLibraryVisualScenesWriter ColladaCOLLADAWriter::OpenLibraryVisualScenes()
{
	return ColladaLibraryVisualScenesWriter(GetFileWriter());
}

ColladaSceneWriter ColladaCOLLADAWriter::OpenScene()
{
	return ColladaSceneWriter(GetFileWriter());
}

ColladaCOLLADAWriter::COLLADA_ELEMENT_CTOR_IMPL(ColladaCOLLADAWriter)
{
	GetXmlWriter().OpenElement(ColladaStrings::ELEM_COLLADA);
	switch (GetVersion())
	{
		case ColladaVersion::Version150:
			GetXmlWriter().AddAttribute(ColladaStrings::ATTR_VERSION, ColladaStrings::VERSION_1_5_0);
			break;
	}
}

// -------------------------------------------------------------------------------------------------------------------------------------
//		File Writer
// -------------------------------------------------------------------------------------------------------------------------------------

ColladaFileWriter::ColladaFileWriter(ColladaVersion::Type version)
	: m_Version(version)
{
}

bool ColladaFileWriter::SetPath(const string& path)
{
	return m_XmlWriter.SetPath(path);
}

ColladaCOLLADAWriter ColladaFileWriter::OpenCOLLADA()
{
	return ColladaCOLLADAWriter(*this);
}
